This file contains hidden or 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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
inputValue: '', | |
mouseUpCount: 0, | |
mouseOverCount: 0, |
This file contains hidden or 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
{ | |
"type": "FeatureCollection", | |
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::102008" } }, | |
"features": [ | |
{ "type": "Feature", "properties": { "name": "Abilene-sweetwater", "latitude": 32.404348, "tvperc": 89.2, "dma": 662, "dma1": "Abilene-Sweetwater, TX", "cableperc": 38.2, "adsperc": 51.8, "longitude": -99.8293625, "woeid": "24701160", "id": "24701160" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -241949.712413945380831, -968504.571903971140273 ], [ -273678.904670911259018, -994063.712760299793445 ], [ -294117.95397367834812, -992237.657947928877547 ], [ -301759.874027342826594, -1000327.639050370897166 ], [ -329881.11736338539049, -992670.775121580692939 ], [ -336211.2980738246697, -979745.653697608504444 ], [ -384409.521632804593537, -977149.374085129587911 ], [ -381821.615684330812655, -919272.881358372047544 ], [ -467139.32645374146523, -914452.942907638964243 ], [ -460539.450352249841671, -812716.538863145629875 ], [ -402441.160641287046019, -815688.869402655167505 |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
{ | |
"type": "FeatureCollection", | |
"features": [ | |
{ | |
"type": "Feature", | |
"id": "Abilene-sweetwater", | |
"properties": { | |
"name": "Abilene-sweetwater", | |
"latitude": 32.404348, |
This file contains hidden or 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
Given an input string, return the commands need to input the string in a dvr. Commands are “l”, “r”, “u”, “d”, and “*”. | |
input was "bad" -> "r*l*rrr*" | |
[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 hidden or 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
public boolean lastIsSingleByteChar(byte[] bytes) { | |
final int N = bytes.length; | |
if (N == 0) { | |
throw new IllegalArgumentException(); | |
} | |
if (N == 1) { | |
return true; | |
} | |
int i = N - 1; |
This file contains hidden or 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
Given a 2d array as a maze with '. (open space)' and 'G (guard)', update each open spaces with the distance to its nearest guard. | |
Example -> | |
matrix : | |
. . . G . | |
. . G . . | |
. . . . G | |
answer -> | |
2 1 1 G 1 | |
2 1 G 1 1 | |
2 1 1 1 G |
This file contains hidden or 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
FILE* open (char* filename); | |
int write(FILE* fd, char* str); | |
int close(FILE* fd); | |
class File { | |
FILE* fd; | |
public: | |
File(string filename) { | |
fd = open(filename.to_c_str()); | |
} |
This file contains hidden or 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
class Node { | |
Node left; | |
Node right; | |
int treeSize; | |
int val; | |
} | |
public float getMedian(Node root) { | |
if (root == null) { | |
return 0; // not sure how you want to handle empty tree |
This file contains hidden or 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
public int countPair(int[] A, int X) { | |
int small = 0; | |
int big = 0; | |
int count = 0; | |
// find max big such that A[0] + A[big] <= X | |
while (big + 1 < A.length && A[0] + A[big + 1] <= X) { | |
big++; | |
} | |
// count use A[small] as smallest number, A[small + 1: big] as bigger number |
This file contains hidden or 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
public class IncreasingSubarray { | |
public static void main(String[] argv) { | |
IncreasingSubarray is = new IncreasingSubarray(); | |
System.out.println(is.solution(new int[]{2, 2, 2, 2, 1, 2, -1, 2, 1, 3})); | |
System.out.println(is.solution(new int[]{30, 20, 10})); | |
System.out.println(is.solution(new int[]{30})); | |
System.out.println(is.solution(new int[]{1, 2, 3, 4, 1, 2, 3, 4, 5})); | |
} | |
public int solution(int[] A) { |
NewerOlder