上一页 1 2 3 4 5 6 7 8 9 10 ··· 28 下一页
摘要: or this question, the key part is: what is the state of the game? Intuitively, to uniquely determine the result of any state, we need to know: A secon 阅读全文
posted @ 2017-12-02 01:49 apanda009 阅读(250) 评论(0) 推荐(0) 编辑
摘要: public class RetainBestCache { private Map cache;. 鍥磋鎴戜滑@1point 3 acres private Map> rankingOfObject;.鏈枃鍘熷垱鑷�1point3acres璁哄潧 private DataSource dataSource; private int maxSiz... 阅读全文
posted @ 2017-12-02 00:14 apanda009 阅读(5647) 评论(0) 推荐(0) 编辑
摘要: 基本思路就是递归的把k sum化成k-1 sum,直到变成trivial的2sum来做。 可以用两个hashset 存元素,sum ,这样就是store O(n), get(O(1)) 阅读全文
posted @ 2017-12-02 00:09 apanda009 阅读(160) 评论(0) 推荐(0) 编辑
摘要: This was asked in LinkedIn Interview Given a list of child->parent relationships, build a binary tree out of it. All the element Ids inside the tree are unique. Example: Given the following relatio... 阅读全文
posted @ 2017-12-01 23:47 apanda009 阅读(375) 评论(0) 推荐(0) 编辑
摘要: public class TextFile implements Iterable{ private BufferedReader br; public TextFile(String fileName) throws FileNotFoundException { br = new BufferedReader(new FileR... 阅读全文
posted @ 2017-12-01 22:07 apanda009 阅读(139) 评论(0) 推荐(0) 编辑
摘要: public class MyList { private static final int DEFAULT_CAPACITY = 10; private E[] elements; private int size = 0; public MyList() { elements = new E[DEFAULT_CAPACITY]; ... 阅读全文
posted @ 2017-12-01 12:49 apanda009 阅读(143) 评论(0) 推荐(0) 编辑
摘要: public static String intToRoman(int num) { String M[] = {"", "M", "MM", "MMM"}; String C[] = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}; Strin 阅读全文
posted @ 2017-12-01 11:00 apanda009 阅读(86) 评论(0) 推荐(0) 编辑
摘要: input check, 正数? In every recursion, we at most try k groups, which means the search tree has k branches at most. And the depth of the search tree is 阅读全文
posted @ 2017-12-01 09:29 apanda009 阅读(275) 评论(0) 推荐(0) 编辑
摘要: The most common concurrency problem I've seen, is not realizing that a field written by one thread is not guaranteed to be seen by a different thread. 阅读全文
posted @ 2017-11-30 22:27 apanda009 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Brute Force的做法,N个点两两可以构成N(N-1)/2条线,我们可以找这N(N-1)/2条线中线上点数最大值,只需对每一条线再进行一层O(N)的遍历,总共是O(N^3)。 用第二种方法更好,选一个基准点, 看后面每一个点跟它构成的直线, 维护一个HashMap, key是跟这个点构成直线的 阅读全文
posted @ 2017-11-30 22:08 apanda009 阅读(214) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 28 下一页