This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def shuffle(in_arr): | |
n = len(in_arr) | |
for i in range(n-1,-1,-1): | |
j = random.randint(0,i) | |
in_arr[i],in_arr[j] = in_arr[j],in_arr[i] | |
return in_arr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
def isPlainDrome(inDeque): | |
while len(inDeque) > 1: | |
if inDeque.pop() != inDeque.popleft(): | |
return False | |
return True | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#kb_map = [ ['a','b','c','d','e'], | |
# ['f','g','h','i','j'], | |
# ['k','l','m','n','o'], | |
# ['p','q','r','s','t'], | |
# ['u','v','w','x','y'], | |
# ['z', ' ', ' ', ' ', ' '] | |
# ] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int main(int argc, char *argv[]) { | |
vector <int> A = {10,20,30,40,50,60,70,80}; | |
int i = A.size()-1; | |
vector <int> B = {11,22,33,44}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <deque> | |
using namespace std; | |
bool isPalindrome(const char *in) { | |
deque<char> dq; | |
while (*in != '\0') { | |
dq.push_back(*in); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <map> | |
#include <queue> | |
#include <math.h> | |
using namespace std; | |
class Point | |
{ |
NewerOlder