LeetCode 225. Implement Stack using Queues

1
2
3
4
5
6
7
8
9
10
static auto x = []()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    return 0;
}();
class MyStack {
private:
    queue q;
publ[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=765">Read more</a></p>

LeetCode 205. Isomorphic Strings

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:
    bool isIsomorp[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=763">Read more</a></p>

LeetCode 119. Pascal’s Triangle II

1
2
3
4
5
/**
 * Note: The returned array must be malloced, assume caller calls free().
 */

int* getRow(int rowIndex, int* returnSize){
     *returnSize=r[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=761">Read more</a></p>

LeetCode 111. Minimum Depth of Binary Tree

1
2
3
4
5
6
7
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 *[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=759">Read more</a></p>

LeetCode 633. Sum of Square Numbers

1
2
3
4
5
6
7
8
9
bool check(int d){
    int t= sqrt(d);
    return d==t*t;
}
bool judgeSquareSum(int c){
    if(c%4==3)return false;
   
    long a=0;
    l[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=753">Read more</a></p>

LeetCode 374. Guess Number Higher or Lower

1
2
3
// Forward declaration of guess API.
// @param num, your guess
// @return -1 if my number is lower, 1 if my number is higher, otherwise return 0[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=751">Read more</a></p>

LeetCode 1089. Duplicate Zeros

1
2
3
4
void duplicateZeros(int* arr, int arrSize){
    int* t=(int*)malloc(sizeof(int)*arrSize);
    memcpy(t,arr,sizeof(int)*arrSize);
    int ai=0,ti=[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=748">Read more</a></p>