Advance C/C++
Table of Contents
1. Sort
3. 2D Array
3.1. Array of string
- CPP
- C
1: #include <stdio.h> 2: #include <string.h> 3: #include <stdlib.h> 4: int main(int argc, const char * argv[]) { 5: // insert code here... 6: char poker[53][5]; 7: char m[4] = {'A','B','C','D'}; 8: char tmp[5]; 9: int i, j, k; 10: for (i = 0; i < 4; i++) { 11: for (j = 0; j < 13; j++) { 12: k = 13 * i + j; 13: sprintf(tmp, "%d%c", j+1, m[i]); 14: //printf("%d: %s\n", k, tmp); 15: strcpy(poker[k], tmp); 16: } 17: } 18: for (i = 0; i < 52; i++) { 19: printf("%s\n", poker[i]); 20: } 21: 22: return 0; 23: } 24:
4. Variable
4.1. Global v.s. Local
7. 資料結構
7.1. Array
- Find 2’s complement: https://www.youtube.com/watch?v=cDCWZ-9ugYM
- First Unique Character in a string: https://www.youtube.com/watch?v=vCB_0cFQr5o
7.2. Stack
7.3. Queue
7.4. Vector: 強化版的陣列
9. LeeCode
- 【C 語言的 LeetCode 五月挑戰】第六天 (Majority Element)
- brute force: for-for
- random
- sort
- hashtable
- divide and conquer
- brute force: for-for
- 【C 語言的 LeetCode 五月挑戰】第七天 (Cousins in Binary Tree)
- Binary tree
- coutn tree depth
- Binary tree
- 【C 語言的 LeetCode 五月挑戰】第八天 (Check If It Is a Straight Line)
- 【C 語言的 LeetCode 五月挑戰】第三天 (Ransom Note)
- 1d Array
- 宇元計數與比對
- 1d Array