Skip to content

Instantly share code, notes, and snippets.

Wei Lin tolinwei

Block or report user

Report or block tolinwei

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:f7ff3aecc416a3333964ffe331295e6d
{
"slots": [
"SportsTeam"
],
"prioritizedAuthorities": [
{
"rankedAuthorities": [
"LIVE_TV_SPORTS_TEAM_ER_SERVICE",
"LIVE_SPORTS_ER_SERVICE"
]
View HashMapTraversal.java
import java.util.*;
public class Main {
public static void main(String args[])
{
Map<Integer, Integer> map = new HashMap();
map.put(1, 3);
map.put(2, 4);
map.put(5, 7);
View match.java
public int countSquare ( boolean[][] ver , boolean[][] hor ) {
if ( ver == null || hor == null || ver.length == 0 || ver[0].length == 0 || hor.length == 0 || hor[0].length == 0 ){
return 0;
}
int[][] dpV = new int[ ver.length ][ ver[0].length ];
int[][] dpH = new int[ hor.length ][ hor[0].length ];
int res = 0;
for ( int j = 0; j < dpV[0].length; ++j) {
View match.java
public int countSquare ( boolean[][] ver , boolean[][] hor ) {
if ( ver == null || hor == null || ver.length == 0 || ver[0].length == 0 || hor.length == 0 || hor[0].length == 0 ){
return 0;
}
int[][] dpV = new int[ ver.length ][ ver[0].length ];
int[][] dpH = new int[ hor.length ][ hor[0].length ];
int res = 0;
for ( int j = 0; j < dpV[0].length; ++j) {
View match.java
public int countSquare ( boolean[][] ver , boolean[][] hor ) {
if ( ver == null || hor == null || ver.length == 0 || ver[0].length == 0 || hor.length == 0 || hor[0].length == 0 ){
return 0;
}
int[][] dpV = new int[ ver.length ][ ver[0].length ];
int[][] dpH = new int[ hor.length ][ hor[0].length ];
int res = 0;
for ( int j = 0; j < dpV[0].length; ++j) {
@tolinwei
tolinwei / SerializingBinaryTree.java
Created Oct 16, 2016 — forked from bittib/SerializingBinaryTree.java
Serialize and Deserialize a Binary Tree (pre order).
View SerializingBinaryTree.java
class TreeNode{
int val;
TreeNode left, right;
TreeNode(int val){
this.val = val;
}
}
public String serialize(TreeNode root){
StringBuilder sb = new StringBuilder();
View Bit
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.InterruptedIOException;
import java.util.*;
public class Main {
public static void main(String[] args) {
System.out.println(getIntegerComplement(50));
System.out.println(getIntegerComplement(100));
View DecodeWays.java
public class DecodeWays {
/**
* @param s a string, encoded message
* @return an integer, the number of ways decoding
*/
private int res = 0;
public int numDecodings(String s) {
// Write your code here
if (s == null || s.length() == 0) {
return 0;
View LRUCache.java
public class Solution { // extends LinkedHashMap<Integer, Integer> {
// Map<Integer, Integer> map;
// LinkedList<Integer> map;
int capacity;
LinkedHashMap<Integer, Integer> cache;
// @param capacity, an integer
public Solution(final int capacity) { // local variable capacity is accessed from within inner class;
View LRUCache.java
public class LRUCache extends LinkedHashMap<integer, string=""> {
private int cacheSize;
public LRUCache(int size) {
super(size, 0.75f, true);
this.cacheSize = size;
}
@Override
protected boolean removeEldestEntry(
You can’t perform that action at this time.