Instantly share code, notes, and snippets.

🌴
On vacation

# t k tahia-khan

🌴
On vacation
• Sort options
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 #include #include #define N 5 typedef enum{BLACK, WHITE, START, END} tile; typedef enum{UNDISCOVERED, DISCOVERED, PROCESSED}graph_state; typedef struct {
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 #include #include #define N_CITIES 4 typedef enum{A, B, C, D, None=-1}city; typedef struct { int start;
Created Dec 23, 2015
View io_error.c
 #include #include int main() { int nbytes, ncases, i, j, k; char c, res; char ** msgs; scanf("%d", &ncases); msgs = malloc(ncases * sizeof(char *));
Created Mar 10, 2016
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
Created Mar 10, 2016
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:
Created Mar 11, 2016
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:
Created Mar 11, 2016
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
Created Mar 11, 2016
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):
Created Mar 14, 2016
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
Created Mar 15, 2016
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.