1 2 3 4 5 6 | int flipLights(int n, int m) { if(m==0||n==0)return 1; if(n==1)return 2; if(n==2){ if(m==1){ return 3;[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=376">Read more</a></p> |
LeetCode 554. Brick Wall
1 2 3 4 5 6 7 8 9 | static auto x = []() { ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }(); class Solution { public: int leastBrick[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=372">Read more</a></p> |
LeetCode 881. Boats to Save People
1 2 3 4 5 | int cmp(void* a,void* b){ return *(int*)a-*(int*)b; } int numRescueBoats(int* people, int peopleSize, int limit) { qsort(people, peopleS[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=370">Read more</a></p> |
LeetCode 898. Bitwise ORs of Subarrays
1 2 3 4 5 6 7 8 9 10 11 | static auto x = []() { ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }(); class Solution { public: int subarr[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=368">Read more</a></p> |
LeetCode 201. Bitwise AND of Numbers Range
1 2 | int rangeBitwiseAnd(int m, int n) { return m==n?m:(rangeBitwiseAnd(m>>1,n>>1)[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=366">Read more</a></p> |
LeetCode 145. Binary Tree Postorder Traversal
1 2 3 4 5 6 7 8 | static auto x = []() { ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }(); /** * Definition for a binary tree node.[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=363">Read more</a></p> |
LeetCode 103. Binary Tree Zigzag Level Order Traversal
1 2 3 4 5 6 7 8 9 | static auto x = []() { ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }(); /** * Definition for a binary tree node.[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=359">Read more</a></p> |
LeetCode 823. Binary Trees With Factors
1 2 3 4 5 6 | int cmp(const void * a,const void * b) { return (*(int*)a-*(int*)b); } int numFactoredBinaryTrees(int* A, int ASize) { if(ASize[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=360">Read more</a></p> |
LeetCode 199. Binary Tree Right Side View
1 2 3 4 5 6 7 8 | static auto x = []() { ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }(); /** * Definition for a binary tree node.[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=357">Read more</a></p> |
LeetCode 814. Binary Tree Pruning
1 2 3 4 5 6 7 8 | static auto x = []() { ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }(); /** * Definition for a binary tree node.[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=355">Read more</a></p> |