Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ariel Vernaza dsapandora

🏠
Working from home
View GitHub Profile
View Determining_DNA_Health.py
from math import inf
from bisect import bisect_left as bLeft, bisect_right as bRight
from collections import defaultdict
def getHealth(seq, first, last, largest):
h, ls = 0, len(seq)
for f in range(ls):
for j in range(1, largest+1):
if f+j > ls:
View open_features.py
import h5py
import os
import requests
import numpy as np
DOWNLOADS_DIR = <folder>
username=<user>
password=<Password>
country = <filename>
i= 0
@dsapandora
dsapandora / version.cpp
Created Apr 14, 2020
Swap Kth node from beginning with Kth node from end in a Linked List
View version.cpp
// A C++ program to swap Kth node from beginning with kth node from end
#include <bits/stdc++.h>
using namespace std;
// A Linked List node
struct Node
{
int data;
struct Node *next;
};
@dsapandora
dsapandora / version.cpp
Created Apr 13, 2020
Level Order Tree Traversal
View version.cpp
/* C++ program to print level order traversal using STL */
#include <bits/stdc++.h>
using namespace std;
// A Binary Tree Node
struct Node
{
int data;
struct Node *left, *right;
};
@dsapandora
dsapandora / version.cpp
Last active Apr 13, 2020
Arrange given numbers to form the biggest number
View version.cpp
// Given an array of numbers, program to arrange the numbers to form the
// largest number
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
// A comparison function which is used by sort() in printLargest()
int myCompare(string X, string Y)
@dsapandora
dsapandora / version.cpp
Last active Apr 13, 2020
The Celebrity Problem
View version.cpp
// C++ program to find
// celebrity in O(n) time
// and O(1) extra space
#include <bits/stdc++.h>
using namespace std;
// Max # of persons in the party
#define N 8
// Person with 2 is celebrity
@dsapandora
dsapandora / version.cpp
Created Apr 13, 2020
Print a Binary Tree in Vertical Order
View version.cpp
#include <iostream>
using namespace std;
// A node of binary tree
struct Node
{
int data;
struct Node *left, *right;
};
@dsapandora
dsapandora / version.cpp
Created Apr 13, 2020
Serielize a binary tree
View version.cpp
// A C++ program to demonstrate serialization and deserialiation of
// Binary Tree
#include <stdio.h>
#define MARKER -1
/* A binary tree Node has key, pointer to left and right children */
struct Node
{
int key;
struct Node* left, *right;
@dsapandora
dsapandora / version.cpp
Created Apr 6, 2020
car chasis factory
View version.cpp
// A C++ program to find minimum possible
// time by the car chassis to complete
#include <bits/stdc++.h>
using namespace std;
#define NUM_LINE 2
#define NUM_STATION 4
// Utility function to find minimum of two numbers
int min(int a, int b)
{
View version.cpp
// A Dynamic Programming based C++ program to find minimum
// number operations to convert str1 to str2
#include <bits/stdc++.h>
using namespace std;
// Utility function to find the minimum of three numbers
int min(int x, int y, int z)
{
return min(min(x, y), z);
}
You can’t perform that action at this time.