View Coins.cpp
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 <cstring> | |
// This is a toy program, so please excuse the trivial flaws. | |
#define MAXN 2000 | |
#define MAXC 20 | |
// An N*C array, hard-coding the max N = 2000, C = 20. | |
int r[MAXN][MAXC]; | |
int cval[MAXC]; | |
int N, C; |
View gist:319b2a89d6bbb5ca0836
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
pttrns.com => For patterns. | |
Reference Counting (arc). | |
@ for NSLiteral, so that "" doesn't mean C-string. | |
Set tableView delegate and dataSource = self. | |
Set numberOfRowsInSection | |
Set cell | |
View gist:95a689aaadea3365a144
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
If you delete the default Storyboard etc., put this in the AppDelegate.m | |
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
When setting things like images in cells, reuse the cells. For some reason, if you allocate a fresh cell, it doesn't work. | |
Pass data between controllers, rather than views, or modifying the view of the next controller. |
View gist:b43132bfe5801ca90466
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
* Select Image View Mode for Image Resizing if its bigger than the screen. | |
* Delegate - Add callbacks somewhere else when something changes. | |
* protocol and interface are synonyms in objc. | |
Delegate Pattern | |
* Can use delegate instead of passing around controllers. | |
* Mark protocol methods as @optional if you dont need them. | |
* Check this via respondsToSelector method. | |
* KVO |
View gist:195dd2ce87f62d2db66d
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
1. Do binary search on a rotated array. | |
Eg., given [100, 110, 121, 5, 11, 44, 78, 91, 99], be able to binary search on it. | |
2. Implement the * and / operations without actual multiplication and division. | |
3. Implement the ^ operator without using any in-build exponentiation methods. | |
4. Implement the median of an unsorted array in O(n). | |
5. Implement sqrt() |
View gist:bca9be25e50a475044a7
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
Delivery/Logistics: | |
Instacart | |
Munchery | |
Lyft | |
Sidecar | |
Uber | |
Thumbtack | |
DoorDash | |
Grubhub | |
Seamless |
View djikstra-slow.cpp
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 <cassert> | |
using namespace std; | |
struct Edge { | |
int src, dst; | |
int w; | |
}; |
View githubcommitinfo.rb
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/env ruby | |
# githubcommitinfo.rb - Fetches info about a commit on github. | |
# http://develop.github.com/p/commits.html | |
# Usage: $ ./githubcommitinfo.rb <gh_username> <gh_repo> <gh_branch> | |
# Dependencies: | |
# rubygems |
View cse506_proposal
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
Extending the JOS File System | |
People: | |
Aniruddha Laud | |
Gaurav Menghani | |
Synopsis: | |
The JOS filesystem is a bare-bones filesystem, which can be improved upon by adding | |
features of a contemporary filesystems. We propose implementing the following |
View ae2a-draft.cpp
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<cstring> | |
#include<cstdio> | |
using namespace std; | |
#define MAXN 1000 | |
bool done[MAXN+10][MAXN*6+10]; | |
long double dp[MAXN+10][MAXN*6+10]; |
OlderNewer