Advance C/C++
Table of Contents
1. Sort
3. 2D Array
3.1. Array of string
- CPP
- C
1: 2: #include <stdio.h> 3: #include <string.h> 4: #include <stdlib.h> 5: int main(int argc, const char * argv[]) { 6: // insert code here... 7: char poker[53][5]; 8: char m[4] = {'A','B','C','D'}; 9: char tmp[5]; 10: int i, j, k; 11: for (i = 0; i < 4; i++) { 12: for (j = 0; j < 13; j++) { 13: k = 13 * i + j; 14: sprintf(tmp, "%d%c", j+1, m[i]); 15: //printf("%d: %s\n", k, tmp); 16: strcpy(poker[k], tmp); 17: } 18: } 19: for (i = 0; i < 52; i++) { 20: printf("%s\n", poker[i]); 21: } 22: 23: return 0; 24: } 25:
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