LeetCode 672. Bulb Switcher II

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 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 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>