摘要: This question is confusing. But if we see the wrong cases below, we can understand the meaning.If word's abbr is not in dic, then return true.Else if ... 阅读全文
posted @ 2015-11-25 14:05 CathyXiaohe 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Best Solution 0ms/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right... 阅读全文
posted @ 2015-11-22 10:35 CathyXiaohe 阅读(148) 评论(0) 推荐(0) 编辑
摘要: This is almost the best solution.16ms./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode... 阅读全文
posted @ 2015-11-22 10:31 CathyXiaohe 阅读(116) 评论(0) 推荐(0) 编辑
摘要: This is the best solution.4ms/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct Tre... 阅读全文
posted @ 2015-11-22 10:27 CathyXiaohe 阅读(95) 评论(0) 推荐(0) 编辑
摘要: (1)This one I used DP.O(n).Runtime:3 msThis is the only one I have can be accepted on leetcode.public classNumArray { privateint[] acc;//acc[i]:recor... 阅读全文
posted @ 2015-11-22 10:22 CathyXiaohe 阅读(108) 评论(0) 推荐(0) 编辑
摘要: This is not the best one.public class Solution { public int addDigits(int num) { if(num=10) { sum=sum+num%... 阅读全文
posted @ 2015-11-22 10:20 CathyXiaohe 阅读(131) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public boolean canWinNim(int n) { if(n%4==0) return false; return true; }} 阅读全文
posted @ 2015-11-22 10:16 CathyXiaohe 阅读(107) 评论(0) 推荐(0) 编辑
摘要: (1)Best way.94%This one uses Lagrange's four-square theorem.According to it, every integer is a sum of at most 4 perfect square numbers. Therefore the... 阅读全文
posted @ 2015-11-22 10:09 CathyXiaohe 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Given a bounch of points, ask to find K closest point to origin.This question can be changed. For example, here is origin, but there might be another ... 阅读全文
posted @ 2015-11-22 09:40 CathyXiaohe 阅读(198) 评论(0) 推荐(0) 编辑