Skip to content

frdmu/Coding

Repository files navigation

Problem List (245)

Leet Code

# Title Solution Difficulty
1898 Maximum Number of Removable Characters Binary Search Medium
1893 Check if All the Integers in a Range Are Covered Different Array Prefix Sum Hash Table Simple
1877 Minimize Maximum Pair Sum in Array Sort Two Pointers Medium
1846 Maximum Element After Decreasing and Rearranging Array Sort Medium
1838 Frequency of the Most Frequent Element Sliding Window Medium
1818 Minimum Absolute Sum Difference Array Binary Search Medium
1337 The K Weakest Rows in a Matrix Binary Search Heap Simple
1104 Path In Zigzag Labelled Binary Tree Array Binary Tree Medium
987 Vertical Order Traversal of a Binary Tree Sort Tree Traversal Hard
981 Time Based Key-Value Store Hash Table Medium
930 Binary Subarrays With Sum Prefix Sum Hash Table Medium
863 All Nodes Distance K in Binary Tree DFS BFS Medium
847 Shortest Path Visiting All Nodes Bitmask BFS Hard
802 Find Eventual Safe States Topological Sort Medium
743 Network Delay Time DisjKstra Floyd Medium
673 Number of Longest Increasing Subsequence Dynamic Programming Medium
611 Valid Triangle Number Array Binary Search Sort Medium
581 Shortest Unsorted Continuous Subarray Array Sort Medium
560 Subarray Sum Equals K Prefix Sum Hash Table Medium
475 Heaters Array Binary Search Medium
446 Arithmetic Slices II - Subsequence DP Hard
416 Partition Equal Subset Sum DP Medium
413 Arithmetic Slices Prefix Sum Slicing Window Medium
406 Queue Reconstruction by Height Greedy Sort & Insert Medium
378 Kth Smallest Element in a Sorted Matrix Heap Medium
349 Intersection of Two Arrays Hash Table Binary Search Simple
313 Super Ugly Number Heap Hash Table Many Pointers Medium
300 Longest Increasing Subsequence Binary Search Dynamic Programming Medium
275 H-Index II Binary Search Medium
274 H-Index Sort Simulation Medium
264 Ugly Number II Heap Hash Table Dynamic Programming Medium
229 Majority Element II Moore Vote Medium
218 The Skyline Problem Heap Line Sweep Hard
209 Minimum Size Subarray Sum Sliding Window Two Pointers Medium
191 Number of 1 Bits Bit Manipulation Simple
171 Excel Sheet Column Number Math String Simple
169 Majority Element Moore Vote Simple
160 Intersection of Two Linked Lists Two Pointer Simple
143 Reorder List Link List Fast and slow pointers Medium
138 Copy List with Random Pointer Hash Table Link List Medium
101 Symmetric Tree Binary Tree Simple
76 Minimum Window Substring Hash Table Sliding Window Hard
72 Edit Distance Dynamic Programming Hard
53 Maximum Subarray Dynamic Programming Simple
50 Pow(x, n) Math Medium
43 Multiply Strings Simulation Medium
34 Find First and Last Position of Element in Sorted Array Binary Search Medium

剑指 Offer

# Title Solution Difficulty
61 扑克牌中的顺子 Math Simple
60 n个骰子的点数 Dynamic Programming Medium
59 - I 滑动窗口的最大值 Sliding Window Monotonic Queue Heap Hard
56 - II 数组中数字出现的次数 II Bit Manipulation Medium
56 - I 数组中数字出现的次数 Bit Manipulation Medium
55 - I 二叉树的深度 BFS DFS Simple
53 - I 在排序数组中查找数字 I Binary Search Simple
52 两个链表的第一个公共节点 Hash Table Two Pointer Simple
51 数组中的逆序对 Merge Sort Hard
50 第一个只出现一次的字符 Hash Table Simple
49 丑数 Heap Medium
48 最长不含重复字符的子字符串 Hash Table Slicing Window Medium
45 把数组排成最小的数 Sort Medium
42 连续子数组的最大和 Dynamic Programming Simple
40 最小的k个数 Array Sort Simple
38 字符串的排列 Backtracing Medium
37 序列化二叉树 Level Order Simulation Hard
36 二叉搜索树与双向链表 inOrder Medium
35 复杂链表的复制 Linklist HashTable Recursive Medium
33 二叉搜索树的后序遍历序列 Binary Serach Tree Medium
31 栈的压入、弹出序列 Stack Simulation Medium
30 包含min函数的栈 Design Two Stacks Simple
29 顺时针打印矩阵 Simulation Simple
28 对称的二叉树 Tree Treversal Simple
27 二叉树的镜像 Tree Treversal Simple
26 树的子结构 Level Order Recursive Medium
25 合并两个排序的链表 Two Pointers Simple
24 反转链表 Recursive Two Pointers Simple
22 链表中倒数第k个节点 Linklist Two Pointers Simple
21 调整数组顺序使奇数位于偶数前面 Array Two Pointers Simple
20 表示数值的字符串 String State Machine Medium
18 删除链表的节点 Dummy Node Linklist Simple
16 数值的整数次方 Math Medium
15 二进制中1的个数 Math Simple
14 - II 剪绳子 Greedy Medium
14 - I 剪绳子 Dynamic Programming Medium
13 机器人的运动范围 BFS DFS Medium
12 矩阵中的路径 Backtracing Medium
10 - II 青蛙跳台阶问题 记忆化搜索 Simple
10 - I 斐波那契数列 记忆化搜索 Simple
09 用两个栈实现队列 Simulation Simple

面试题

# Title Solution Difficulty
17.10 主要元素 Moore Vote Simple
16.25 LRU 缓存 Hash Table Linked List Medium
10.02 变位词组 Hash Table Sort Medium

动态规划

股票问题

# Title Difficulty
121 Best Time to Buy and Sell Stock Simple
122 Best Time to Buy and Sell Stock II Simple
123 Best Time to Buy and Sell Stock III Hard
188 Best Time to Buy and Sell Stock IV Hard
309 Best Time to Buy and Sell Stock with Cooldown Medium
714 Best Time to Buy and Sell Stock with Transaction Fee Medium

打家劫舍

# Title Difficulty
198 House Robber Medium
213 House Robber II Medium
337 House Robber III Medium

NowCoder

# Title Solution Difficulty
华为机试题 扑克牌大小 String Medium
华为机试题 简单错误记录 String Medium
华为机试题 四则运算 Stack Medium
华为机试题 最小公倍数 Math Simple

Class

# Type Quantity Feature
1 Array 9 binary search, slicing window, fast and slow pointer, simulate
2 Backtracing 17
3 Design 3
4 Dfs_Bfs 1
5 Divide_and_Conquer 2
6 DP 10
7 Greedy_algorithm 11
8 HashTable 8
9 Heap 2
10 List 8 new a dummy head node
11 Math 8
12 Search 4
13 Sort 3
14 Stack 8
15 String 10
16 Tree 31
17 Two pointers 11 sorted array, fast and slow pointer
18 Nowcoder 1

Notes

Useful Functions

STL Func Description Lib
string int isdigit(char ch) isdigit('2') <cstdio>
string string substr(int pos, int len) s.substr(0, 5)) <string>
string void resize(int n) s.resize(n)) <string>
string int stoi("22") string to int <string>
string empty(), back(), push_back(), pop_back() just like a stack <string>
map insert(x) element traversal only via the iterator:*it <map>
map iterator find(key) mp.find(key) <map>
vector vec.push_back(vector<int>{1, 2, 3}) vector<vector<int> > vec <vector>
vector vec.assign(a.begin(), a.begin()+k) copy data from a to vec <vector>
vector vec.emplace_back(ele) similar to push_back(ele) <vector>
- reverse(vec.begin(), vec.end()) - <algorithm>
unordered_set insert(), find() unordered_set tmp(vec.begin(), vec.end()) <unordered_set>
- *max_element(vec.begin(), vec.end()) - -

Useful template

Hard understand

Problem
31.Next Permutation(Array)
264.Ugly Number II(DP)
347.Top K Frequent Elements(Heap)
239. Sliding Window Maximum(Monotonous queue)

Refer

Releases

No releases published

Packages

No packages published

Languages