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
class Solution { | |
private class Pair implements Comparable<Pair> { | |
private int a; | |
private int b; | |
public Pair(int a, int b) { | |
this.a = a; | |
this.b = b; | |
} | |
public int a() { return a;} |
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
class Solution { | |
private int[] calcDiff(char[] chars) { | |
int[] diffs = new int[chars.length-1]; | |
for(int i = 0; i < chars.length - 1; i++) { | |
diffs[i] = chars[i+1] - chars[i]; | |
} | |
return diffs; | |
} | |
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
class Solution { | |
public String reverseString(String input) { | |
return new StringBuffer(input).reverse().toString(); | |
} | |
public boolean isPalindrome(String str) { | |
if (str.length() == 0) return false; | |
if (str.length() == 1) 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
public class Solution { | |
private int popCount(int x) { | |
int count; | |
for (count = 0; x != 0; ++count) { | |
x &= x - 1; // zeroing out the least significant nonzero bit | |
} | |
return count; | |
} | |
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
class Trie { | |
TrieNode root; | |
public Trie() { | |
root = new TrieNode(); | |
} | |
public TrieNode getRoot() { | |
return root; |
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
# create account | |
mutation createAccount($value:AccountInput!) { | |
createAccount(value:$value) | |
{ | |
id | |
instanceId | |
} | |
} | |
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
# create account.1 | |
mutation createAccount($value:AccountInput!) { | |
createAccount(value:$value) | |
{ | |
id | |
instanceId | |
} | |
} | |
{ |
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
# run a find on pair | |
# add a pair | |
mutation upsert($values:HypiUpsertInputUnion!) { | |
upsert(values:$values){ | |
id | |
} | |
} | |
{ | |
"values": { |
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
mutation createAccount($value:AccountInput!) { | |
createAccount(value:$value) | |
{ | |
id | |
instanceId | |
} | |
} | |
{ |
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
# create some data | |
mutation upsert($values:HypiUpsertInputUnion!) { | |
upsert(values:$values){ | |
id | |
} | |
} | |
{ | |
"values": { | |
"Pair": { |
NewerOlder