摘要:
Clear with edge case. Such as L == 0, what to return. 1 class Solution { 2 public: 3 vector fullJustify(vector &words, int L) { 4 vector r... 阅读全文
摘要:
1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(i... 阅读全文
摘要:
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne... 阅读全文
摘要:
Scanning the border, if found an 'O', set it to 'Y'. Then do the BFS, get the 'Y' arounded 'O' to Y.Then the rest of 'O' will be set to the 'X'. 1 cla... 阅读全文
摘要:
1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(i... 阅读全文
摘要:
For this problem:1. use i = start; i dict) { 4 for (int i = 0; i 0) dict[s.substr(start + i*each, each)]--; 6 else return false;... 阅读全文
摘要:
Nothing fancy. Just skip the duplicated ones as num[i] == num[i-1] 1 class Solution { 2 public: 3 void getComb(vector > &result, vector &num, vect... 阅读全文
摘要:
Classical combination problem. 1 class Solution { 2 public: 3 void getComb(vector > &result, vector &num, vector current, int index, int len) { 4 ... 阅读全文
摘要:
Notes:INT_MAX's fabs is one less than INT_MIN's fabs.So when we use INT_MAX as the index. We need to use = '0') {11 if (result 0 ? IN... 阅读全文
摘要:
Newton method, need enought accuracy of tolerance to handle edge case INT_MAX and INT_MIN: 1 class Solution { 2 public: 3 int sqrt(int x) { 4 ... 阅读全文