MCPcopy Create free account

hub / github.com/Ainevsia/Leetcode-Rust / functions

Functions1,163 in github.com/Ainevsia/Leetcode-Rust

Methodmax_sub_array_linear
linear O(n) search
53. Maximum Subarray/src/main.rs:27
Methodmax_value
(n: i32, index: i32, max_sum: i32)
1802. Number of Students Unable to Eat Lunch/src/lib.rs:4
MethodmaximalRectangle
dp orz
85. Maximal Rectangle/Solution.cpp:15
Methodmaximum_beauty
(mut nums: Vec<i32>, k: i32)
704. 二分查找/src/main.rs:723
Functionmaximum_element_after_decrementing_and_rearranging
(mut arr: Vec<i32>)
1669. Minimum Cost to Cut a Stick/src/main.rs:523
Methodmaximum_jumps
(nums: Vec<i32>, target: i32)
cn/739. 每日温度/src/main.rs:177
Methodmaximum_wealth
(accounts: Vec<Vec<i32>>)
cn/1672. 最富有客户的资产总量/src/main.rs:8
Methodmedian_sliding_window
(nums: Vec<i32>, k: i32)
Two Heaps/480. Sliding Window Median/src/main.rs:11
Methodmerge
(mut intervals: Vec<Vec<i32>>)
Merge Intervals/56. Merge Intervals/src/main.rs:11
Methodmerge
(nums1: &mut Vec<i32>, m: i32, nums2: &mut Vec<i32>, n: i32)
88. Merge Sorted Array/src/main.rs:7
Methodmerge
merge two vectors to get the max number, use vector comparsion O(n) time
Dynamic Programming/321. Create Maximum Number/src/main.rs:25
MethodmergeSort
493. Reverse Pairs/Solution.cpp:18
Methodmerge_in_between
( mut list1: Option<Box<ListNode>>, a: i32, b: i32, list2: Option<Box<ListNode
1669. Minimum Cost to Cut a Stick/src/main.rs:478
Methodmerge_k_lists
this is not written by myself XD, refresh
23. Merge k Sorted Lists/src/main.rs:89
Methodmerge_k_lists
(lists: Vec<Option<Box<ListNode>>>)
23. Merge k Sorted Lists/src/main_bruteforce.rs:77
Functionmerge_k_lists1
(mut lists: Vec<Option<Box<ListNode>>>)
1669. Minimum Cost to Cut a Stick/src/main.rs:436
Methodmerge_two_lists
( l1: Option<Box<ListNode>>, l2: Option<Box<ListNode>>)
21. Merge Two Sorted Lists/src/main.rs:48
MethodminCost
this is a graph dfs problem to search the min distance */
Weekly Contest 178/1368. Minimum Cost to Make at Least One Valid Path in a Grid/Solution.cpp:13
MethodminPathSum
64. Minimum Path Sum/Solution.cpp:16
Methodmin_depth
bfs, use queue
Tree/111. Minimum Depth of Binary Tree/src/main.rs:32
Methodmin_distance
2d dp -> reduce to O(n) space Time: O(mn) not clear and beautiful as before
72. Edit Distance/src/main.rs:11
Methodmin_falling_path_sum
(mut matrix: Vec<Vec<i32>>)
931. Maximum Frequency Stack/src/lib.rs:4
Methodmin_falling_path_sum
(mut matrix: Vec<Vec<i32>>)
1289. Day of the Week/src/lib.rs:4
Methodmin_k_bit_flips
do you know what "code is comment itself" means ?
995. Minimum Number of K Consecutive Bit Flips/src/main.rs:10
Methodmin_moves_to_seat
(mut seats: Vec<i32>, mut students: Vec<i32>)
2037. Count Square Sum Triples/src/lib.rs:4
Methodmin_operations
(nums: Vec<i32>, x: i32)
1658. Minimum Swaps to Arrange a Binary Grid/src/lib.rs:4
Methodmin_path_sum
(mut grid: Vec<Vec<i32>>)
64. Minimum Path Sum/src/main.rs:12
Functionmin_side_jumps
(obstacles: Vec<i32>)
1824. Maximum Number of Eaten Apples/src/lib.rs:1
Methodmin_sub_array_len
(target: i32, nums: Vec<i32>)
704. 二分查找/src/main.rs:878
Methodmin_sub_array_len2
(target: i32, nums: Vec<i32>)
704. 二分查找/src/main.rs:896
Methodmin_subsequence
(mut nums: Vec<i32>)
Weekly Contest 183/p1/src/main.rs:8
Methodmin_window
(s: String, t: String)
Sliding Window/76. Minimum Window Substring/src/main.rs:8
Methodminimum_index
在构建freq的同时记录当前的支配元素?需要orderedmap 用一个变量来记录就行了吧?
704. 二分查找/src/main.rs:777
Methodminimum_length
(s: String)
1750. Check If Two Expression Trees are Equivalent/src/main.rs:8
Methodminimum_moves
(s: String)
2027. Maximum Number of Removable Characters/src/main.rs:28
Methodminimum_total
(mut triangle: Vec<Vec<i32>>)
120. Triangle/src/main.rs:8
Methodmissing_number
(mut nums: Vec<i32>)
Cyclic Sort/268. Missing Number/src/main.rs:8
Methodmost_common_word
(paragraph: String, banned: Vec<String>)
cn/819. 最常见的单词/src/main.rs:10
Methodmoves_to_chessboard
(board: Vec<Vec<i32>>)
782. Transform to Chessboard/src/main.rs:124
Methodmultiply
(num1: String, num2: String)
43. Multiply Strings/src/main.rs:8
Methodmutate
(x: char)
704. 二分查找/src/main.rs:60
Methodmy_atoi
(input: String)
8. String to Integer (atoi)/src/main.rs:11
Methodmy_pow
do the same thing as powi(n): pub fn powi(self, n: i32) -> f64
50. Pow(x, n)/src/main.rs:9
Methodmy_sqrt
(x: i32)
69. Sqrt(x)/src/main.rs:8
Functionmy_test
()
1802. Number of Students Unable to Eat Lunch/src/lib.rs:42
Methodn_unique_char
(s: &[char], k: i32, n: usize)
Sliding Window/395. Longest Substring with At Least K Repeating Characters/src/main.rs:17
Functionname
()
25. Reverse Nodes in k-Group/src/main.rs:162
Methodnew
(expect: i32, count: i32)
30. Substring with Concatenation of All Words/src/main.rs:163
Methodnew
(val: i32)
82. Remove Duplicates from Sorted List II/src/main.rs:28
Methodnew
(val: i32)
2. Add Two Numbers/src/main.rs:10
Methodnew
()
704. 二分查找/src/main.rs:78
Methodnew
(val: i32)
92. Reverse Linked List II/src/main.rs:28
Methodnew
(l: i32, r: i32)
855. Count Unique Characters of All Substrings of a Given String/src/lib.rs:10
Methodnew
(n: i32)
855. Count Unique Characters of All Substrings of a Given String/src/lib_bkup_ac.rs:11
Methodnew
(n: i32)
855. Count Unique Characters of All Substrings of a Given String/src/lib_bkup.rs:14
Methodnew
(n: usize)
1632. Number of Good Ways to Split a String/src/lib.rs:7
Methodnew
(val: i32)
23. Merge k Sorted Lists/src/main.rs:60
Methodnew
(val: i32)
23. Merge k Sorted Lists/src/main_bruteforce.rs:66
Methodnew
(val: i32)
61. Rotate List/src/main.rs:21
Methodnew
(p: char, idx: usize)
32. Longest Valid Parentheses/src/main.rs:82
Methodnew
(val: i32)
Two Pointers/234. Palindrome Linked List/src/main.rs:23
Methodnew
(val: i32)
24. Swap Nodes in Pairs/src/main.rs:28
Methodnew
(m: i32, k: i32)
1825. Find Minimum Time to Finish All Jobs/src/lib.rs:61
Methodnew
(val: i32)
21. Merge Two Sorted Lists/src/main.rs:37
Methodnew
(val: i32)
Tree/113. Path Sum II/src/main.rs:17
Methodnew
(val: i32, left: Option<Rc<RefCell<TreeNode>>>, right: Option<Rc<RefCell<TreeNode>>>)
Tree/938. Range Sum of BST/src/main.rs:20
Methodnew
(val: i32)
Tree/103. Binary Tree Zigzag Level Order Traversal/src/main.rs:17
Methodnew
(val: i32)
Tree/111. Minimum Depth of Binary Tree/src/main.rs:17
Methodnew
(m: usize, n: usize)
Weekly Contest 181/1391. Check if There is a Valid Path in a Grid/src/main.rs:39
Methodnew
initialize your data structure here. */
155. Min Stack/src/main.rs:17
Methodnew
(s: &'a [char], p: &'a [char], dp: &'a mut Vec<Vec<i32>>)
44. Wildcard Matching/src/main.rs:116
Methodnew
what kind of macro is this?
19. Remove Nth Node From End of List/src/main.rs:41
Methodnew
(val: i32)
86. Partition List/src/main.rs:32
Methodnew
(val: i32)
337. House Robber III/src/main.rs:17
Methodnew
(mut stack: Vec<i32>)
Dynamic Programming/321. Create Maximum Number/src/main.rs:75
Methodnew
(val: i32)
1669. Minimum Cost to Cut a Stick/src/main.rs:73
Methodnew
()
1669. Minimum Cost to Cut a Stick/src/list.rs:17
Methodnew
()
Two Heaps/480. Sliding Window Median/src/main.rs:36
Methodnew
initialize your data structure here. */
Two Heaps/295. Find Median from Data Stream/src/main.rs:25
Methodnew
(val: i32)
cn/1305. 两棵二叉搜索树中的所有元素/src/main.rs:27
Methodnew
(iter: A)
1759. Find the Missing IDs/src/main.rs:69
Methodnew
(pizza: &Vec<String>)
1444. Number of Steps to Reduce a Number to Zero/src/main.rs:32
Methodnew
(val: i32)
25. Reverse Nodes in k-Group/src/main.rs:26
Methodnext
Two Pointers/202. Happy Number/Solution.cpp:17
Methodnext
(&mut self)
1669. Minimum Cost to Cut a Stick/src/list.rs:75
MethodnextPermutation
31. Next Permutation/Solution.cpp:15
Methodnext_greater_element
(nums1: Vec<i32>, nums2: Vec<i32>)
cn/739. 每日温度/src/main.rs:255
Methodnext_greater_elements
(nums: Vec<i32>)
cn/739. 每日温度/src/main.rs:239
Methodnext_idx
(i: usize, num: i32, len: usize)
Two Pointers/457. Circular Array Loop/src/main.rs:44
Methodnext_permutation
(nums: &mut Vec<i32>)
47. Permutations II/src/main.rs:21
Methodnext_permutation
(nums: &mut Vec<i32>)
31. Next Permutation/src/main.rs:8
Methodnext_permutation
679. 24 Game/Solution.cpp:66
Methodnode2vec
(head: &Option<Box<ListNode>>)
23. Merge k Sorted Lists/src/main_bruteforce.rs:83
Functionnone
()
25. Reverse Nodes in k-Group/src/main.rs:154
Functionnull
()
10. Regular Expression Matching/src/main.rs:61
MethodnumIslands
200. Number of Islands/Solution.cpp:34
MethodnumOfMinutes
Weekly Contest 179/p3/Solution.cpp:25
MethodnumTeams
Weekly Contest 182/1395. Count Number of Teams/Solution.cpp:15
MethodnumTrees
my version for each round i `buf[x]` means **the number of trees** that has `x` right nodes base on the `buf` vector of the `i - 1` round, we can calc
96. Unique Binary Search Trees/Solution.cpp:20
MethodnumTrees_dp
dp thought O(n) time O(n) space
96. Unique Binary Search Trees/Solution.cpp:43
← previousnext →901–1,000 of 1,163, ranked by callers