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 | |
{ |
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> | |
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
#!/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
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
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
#include <iostream> | |
#include <string> | |
using namespace std; | |
int returnMatchCount(const string &s1, const string &s2) | |
{ | |
int cnt = 0; | |
for (int i = s1.length()-1; i >=0; i--) { | |
string sub_sub = s1.substr(i,s1.length()-i); |
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
Redux attempts to make state mutations predictable by imposing certain restrictions on how and when updates can happen. | |
These restrictions are reflected in the three principles of Redux. | |
- State is single source of truth | |
- State is read-only | |
- Changes are made with pure functions | |
Key terms and concepts: | |
State: |
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 Cocoa | |
@NSApplicationMain | |
class AppDelegate: NSObject, NSApplicationDelegate { | |
@IBOutlet weak var window: NSWindow! | |
func applicationDidFinishLaunching(_ aNotification: Notification) { | |
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
<!DOCTYPE html> | |
<html> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> | |
<body> | |
<div ng-app="myApp"> | |
<div ng-controller="personCtrl"> | |
First Name: <input type="text" ng-model="firstName"><br> | |
Last Name: <input type="text" ng-model="lastName"><br> |
OlderNewer