1 2 3 4 5 | /** * Return an array of size *returnSize. * Note: The returned array must be malloced, assume caller calls free(). */ int* sortArrayByParity[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=113">Read more</a></p> |
LeetCode 944. Delete Columns to Make Sorted
1 2 3 4 | int minDeletionSize(char** A, int ASize) { int colCount=strlen(A[0]); int ret=0; for(int i=0;i[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=111">Read more</a></p> |
LeetCode 929. Unique Email Addresses
LeetCode 224. Basic Calculator
1 2 3 4 5 6 7 | int calculateHelper(char** t){ int ret=0; bool isAdd=true; int num=0; while(**t!='\0'){ if(**t=='('){[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=107">Read more</a></p> |
LeetCode 583. Delete Operation for Two Strings
1 2 3 4 5 6 7 8 | inline int min2(int a,int b){ return a>b?b:a; } inline int min3(int a,int b,int c){ return min2(min2(a,b),c); } int minDistance(char*[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=105">Read more</a></p> |
LeetCode 611. Valid Triangle Number
1 2 3 4 5 6 | int cmpfunc (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); } int triangleNumber(int* nums, int numsSize) { int count[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=102">Read more</a></p> |
LeetCode 392. Is Subsequence
1 2 3 4 5 6 | bool isSubsequence(char* s, char* t) { char* si=s; char* ti=t; while(*si!='\0'&&*ti!='\0'){ if(*si==*ti){ si++;[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=100">Read more</a></p> |
LeetCode 357. Count Numbers with Unique Digits
1 2 3 4 | class Solution { private: int arr[10]={10,9*9,9*9*8,9*9*8*7,9*9*8*7*6,9*9*8*7*6*5,9*9*8*7*6*5*4, 9*9*8*7*6*5*4*3,9*9*8*7*6*5*4*[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=98">Read more</a></p> |
LeetCode 481. Magical String
1 2 3 4 5 6 7 8 9 | class Solution { private: int arr[100000]; bool inited=false; int countArr[100000]; void init(int n){ if(![......]<p class="read-more"><a href="https://www.gerrytang.top/?p=96">Read more</a></p> |
LeetCode 486. Predict the Winner
1 2 3 4 5 6 7 8 | #include using namespace std; class Solution { private: map m; int PredictTheWinnerHelper(vector& nums,int start,int end){[......]<p class="read-more"><a href="https://www.gerrytang.top/?p=93">Read more</a></p> |