Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

t k tahia-khan

🌴
On vacation
Block or report user

Report or block tahia-khan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tahia-khan
tahia-khan / maze.c
Created Nov 10, 2015
given a 2d array of black and white entries representing a maze with designated entrance and exit points, find a path from the entrance to the exist, if one exists.
View maze.c
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define N 5
typedef enum{BLACK, WHITE, START, END} tile;
typedef enum{UNDISCOVERED, DISCOVERED, PROCESSED}graph_state;
typedef struct {
@tahia-khan
tahia-khan / quickest_route.c
Created Nov 10, 2015
given a time-table, a starting city, a starting time and a destination city, how would you compute the soonest you could get to the destination city?
View quickest_route.c
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define N_CITIES 4
typedef enum{A, B, C, D, None=-1}city;
typedef struct {
int start;
View io_error.c
#include <stdio.h>
#include <stdlib.h>
int main() {
int nbytes, ncases, i, j, k;
char c, res;
char ** msgs;
scanf("%d", &ncases);
msgs = malloc(ncases * sizeof(char *));
View CyclicRotation.py
# you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solution(A, K):
# write your code in Python 2.7
result = []
L = len(A)
if L <= 1 or not K or L == K:
return A
View oddoccurances.py
# you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solutionA(A): # 100% but space complexity is not O(1)
L = len(A)
d = {}
if not L: return
for e in A:
View TapeEquilibrium.py
# you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solution(A):
# write your code in Python 2.7
L = len(A)
min = 1000
if L == 1:
View PermMissingElem.py
# you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solution(A):
# write your code in Python 2.7
L = len(A)
if not L: return 0
sum = 0
View FrogRiverOne.py
# you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solution(X, A):
# write your code in Python 2.7
L = len(A)
P = [-1]*X
min = 0
for i in range(0, L):
View PermCheck.py
# you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solution(A):
N = len(A)
if not N: return 0
count = N
View MissingInteger.py
# you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solution(A):
# write your code in Python 2.7
N = len(A)
C = [0] * N
res = 0
for i in A:
You can’t perform that action at this time.