# 淡大 AI 創智社 LeetCode 讀書會規劃 規劃與執行負責人:Milo Chen ### Milo 自介 PyCon Taiwan 2022 講者 PyCon APAC 2023 講者 LeetCode: https://leetcode.com/milochen/ GitHub for LeetCode https://github.com/milochen0418/leetcode 目前是偏鄉國中教中學生一些生活科技與資訊科技 (機構、電路、簡單設計、寫程式(Web, Python, MicroPython FW/SW)) 作一些企業算是科技教練。 以前是有在醫療產業、汽車產業、消費性電子 PM, 架構師, 工程師, ## 時間地點 時間預計為每個 Monday 晚上 PM07:30 ~ PM09:00 地點除特殊見面活動外,使用Google的線上軟體 ## 課程分組進行方式 (1) 每周的題目會讓大家分組合作完成,但前2周的部份,都要個準備。 (2) 第3周後開始分組,每組認幾題來解題,並分享之 (3) 開始分組後,也會徵稿 Lighting Talk ,歡迎學生與業界人事分享一下業界與學界的近況 (4) 第8周是大魔王關,每組專題的方式進行,認領至少1題來作即可。想認多題的組別也歡迎。 (5) 會有實體的見面會,讓大家可以彼此分享認識交流。 (6) 分享者可以自己選擇是否分享文字、影象或是其它東西,留給一些沒來上的人看。 ## 其它 Bonus (1) 分享自己曾經在 AWS, Apple, Google 面試算法的經驗 (2) 分享一下 LeetCode 周賽的資訊,以及為何推薦打周賽 (3) 分享 LeetCode 一些高手們常用的其它資源 。 (4) 不定期邀請台灣 LeetCode 排名前面的高手們來作分享。 (5) 康樂讓大家有更多面對面或是線上交流建人脈的機會 [TOC] # 每周的解題的細節規劃 以 Grind75 為主,但有從中篩選掉一些,標記為 Optioanl 的可作可不作 ## Week 1 第一周都是Easy題,適合練基本功, 每個人都得練才可以未來分組後 team work 順利 第一周的部份會額外多點講解,解釋一個相同的題目可以有許多不同解答。 ### 1. Two Sum Approach 1. Brute Force Approach 2. Two-pass Hash Table Approach 3: One-pass Hash Table ### 2. Valid Parentheses Approach 1. Stacks ### 3. Merge Two Sorted Lists Approach 1. Recursion Approach 2. Iteration ### 4. Best Time to Buy and Sell Stock Approach 1. Brute Force Approach 2. One Pass ### 5. Valid Palindrome Approach 1. Compare with Reverse ### 6. Invert Binary Tree Approach 1. Recursive Approach 2. Iterative ### 7. Valid Anagram Approach 1. Sorting Approach 2. Frequency Counter ### 8. Binary Search Approach 1. Find the Exact Value Approach 2. Find Upper bound Approach 3. Find Lower bound Approach 4. Use built-in tools ### 9. Flood Fill Approach 1. Depth-First Search Approach 2. Breath-First Search Approach 3. Union-Find ### 10. Lowest Common Ancestor of a Binary Search Tree Approach 1. Recursive Approach Approach 2. Iterative Approach ### 11. Balanced Binary Tree Approach 1. Top-down recursion Approach 2. Bottom-up recursion ### 12. Linked List Cycle Approach 1. Hash Table Approach 2. Floyd's Cycle Finding Algorithm ### 13. Implement Queue using Stacks Approach 1. (Two Stacks) Push - O(n) per operation, Pop - O(1) per operation. Approach 2. (Two Stacks) Push - O(1) per operation, Pop - O(n) per operation. ## Week 2 第二周都是Easy題,適合練基本功, 每個人都得練才可以未來分組後 team work 順利 第二周開始就換鼓勵同學的不同解答(如果有的話) 與他們的解題思維分享。 ### 1. First Bad Version Approach 1. Linear Scan (TLE) Approach 2. Binary Search ### 2. Ransom Note Approach 1. Simulation Approach 2. Two HashMaps Approach 3. One HashMap Approach 4. Sorting and Stacks ### 3. Climbing Stairs Approach 1. Brute Force Approach 2. Recursion with Memorization Approach 3. Dynamic Programming Approach 4. Fibonacci Number Approach 5. Binets Method Approach 6. Fibonacci Formula ### 4. Longest Palindrome Approach 1. Greedy ### 5. Reverse Linked List Approach 1. Iterative Approach 2. Recursive ### 6. Majority Element Approach 1. Brute Force Approach 2. HashMap Approach 3. Sorting Approach 4. Bit Manipulation Approach 5. Randomization Approach 6. Divide and Conquer Approach 7. Boyer-Moore Voting Algorithm ### 7. Add Binary Approach 1. Bit-by-Bit Computation Approach 2. Bit Manipulation ### 8. Diameter of Binary Tree Approach 1. Depth-first Search ### 9. Middle of the Linked List Approach 1. Output to Array Approach 2. Fast and Slow Pointer ### 10. Maximum Depth of Binary Tree Approach 1. Recursion Approach 2. Tail Recursion + BFS Approach 3. Iteration ### 11. Contains Duplicate Approach 1. Naive Linear Search(TLE) Approach 2. Sorting Approach 3. Hash Table ### 12. Maximum Subarray Approach 1. Optimized Brute Force Approach 2. Dynamic Programming, Kadane's Algorithm Approach 3. Divide and Conquer(Advanced) ## Week 3 第三周開始就是大家分組進行的方式來分享,並提供 Lighting Talk 大家一些演講的機會交流 ### 1. Insert Interval Approach 1. Linear Search Approach 2. Binary Search ### 2. 01 Matrix Approach 1. Brute force(TLE) Approach 2. Using BFS Approach 3. Dynamic Programming ### 3. K Closest Points to Origin Approach 1. Sort Approach 2. Divide and Conquer ### 4. Longest Substring Without Repeating Characters Approach 1. Brute Force Approach 2. Sliding Window Approach 3. Sliding Window Optimized ### 5. 3Sum Approach 1. Two Pointers Approach 2. Hashset Approach 3. No Sort ### 6. Binary Tree Level Order Traversal Approach 1. Recursion Approach 2. Iteration ### 7. Clone Graph Approach 1. Depth First Search Approach 2. Breadth First Search ### 8. Evaluate Reverse Polish Notation Approach 1. Reducing the List in-place Approach 2. Evaluate with Stack ## Week 4 第4周也是分組進行的方式來分享,並提供 Lighting Talk 大家一些演講的機會交流 ### 1. Course Schedule Approach 1. Backtracking Approach 2. Postorder DFS Approach 3. Topological Sort ### 2. Implement Trie (Prefix Tree) ### 3. Coin Change ### 4. Product of Array Except Self ### 5. Min Stack (Optional) ### 6. Validate Binary Search Tree ### 7. Number of Islands ### 8. Rotting Oranges ## Week 5 第4周也是分組進行的方式來分享,並提供 Lighting Talk 大家一些演講的機會交流 ### 1. Search in Rotated Sorted Array ### 2. Combination Sum ### 3. Permutations ### 4. Merge Intervals ### 5. Lowest Common Ancestor of a Binary Tree ### 6. Time Based Key-Value Store ### 7. Accounts Merge (Optional) ### 8. Sort Colors (Optional) ## Week 6 第4周也是分組進行的方式來分享,並提供 Lighting Talk 大家一些演講的機會交流 ### 1. Word Break ### 2. Partition Equal Subset Sum (Optional) ### 3. String to Integer (atoi) ### 4. Spiral Matrix ### 5. Subsets ### 6. Binary Tree Right Side View (Optional) ### 7. Longest Palindromic Substring (Optional) ### 8. Unique Paths ### 9. Construct Binary Tree from Preorder and Inorder Traversal (Optional) ## Week 7 第4周也是分組進行的方式來分享,並提供 Lighting Talk 大家一些演講的機會交流 ### 1. Container With Most Water ### 2. Letter Combinations of a Phone Number ### 3. Word Search ### 4. Find All Anagrams in a String ### 5. Minimum Height Trees (Optional) ### 6. Task Scheduler (Optional) ### 7. LRU Cache (Optional) ## Week 8 第8周也是分組進行的方式來分享,但因為是Hard 題 所以提供大家可認領1至2題來分享即可。最後仍然有提供 Lighting Talk 大家一些演講的機會交流 ### 1. Kth Smallest Element in a BST ### 2. Minimum Window Substring ### 3. Serialize and Deserialize Binary Tree ### 4. Trapping Rain Water ### 5. Find Median from Data Stream ### 6. Word Ladder ### 7. Basic Calculator ### 8. Maximum Profit in Job Scheduling ### 9. Merge k Sorted Lists ### 10. Largest Rectangle in Histogram