摘要:
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 ... 阅读全文
摘要:
Best Solution 0ms/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right... 阅读全文
摘要:
This is almost the best solution.16ms./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode... 阅读全文
摘要:
This is the best solution.4ms/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct Tre... 阅读全文
摘要:
(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... 阅读全文
摘要:
This is not the best one.public class Solution { public int addDigits(int num) { if(num=10) { sum=sum+num%... 阅读全文
摘要:
public class Solution { public boolean canWinNim(int n) { if(n%4==0) return false; return true; }} 阅读全文
摘要:
(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... 阅读全文
摘要:
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 ... 阅读全文