MCPcopy Create free account

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

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

Methodnum_decodings
(s: String)
91. Decode Ways/src/main.rs:8
Methodnum_decodings
(s: String)
639. Decode Ways II/src/main.rs:8
Methodnum_islands
(mut grid: Vec<Vec<char>>)
200. Number of Islands/src/main.rs:8
Methodnum_steps
(s: String)
Weekly Contest 183/p2/src/main.rs:8
Methodnum_subarray_product_less_than_k
sliding window nums.len() > 0
Two Pointers/713. Subarray Product Less Than K/src/main.rs:11
Functionodd
()
33. Search in Rotated Sorted Array/src/main.rs:83
Functionodd_not_found
()
33. Search in Rotated Sorted Array/src/main.rs:108
Methodoper
679. 24 Game/Solution.cpp:51
Functionoperator++
679. 24 Game/Solution.cpp:17
Methodpart
(s: & Vec<char>, end: usize)
131. Palindrome Partitioning/src/main.rs:16
Methodpartial_cmp
(&self, other: &ListNode)
23. Merge k Sorted Lists/src/main.rs:76
Methodpartial_cmp
(&self,o:&Z)
1669. Minimum Cost to Cut a Stick/src/main.rs:217
Methodpartition
(s: String)
131. Palindrome Partitioning/src/main.rs:11
Methodpath_sum
(root: Option<Rc<RefCell<TreeNode>>>, sum: i32)
Tree/113. Path Sum II/src/main.rs:30
Methodpaths_with_max_score
(board: Vec<String>)
1301. Reformat Department Table/src/lib.rs:6
Methodpb
(board: &Vec<Vec<char>>)
37. Sudoku Solver/src/main.rs:61
Functionpeek
()
1669. Minimum Cost to Cut a Stick/src/list.rs:144
Methodpeek
(&mut self)
704. 二分查找/src/main.rs:158
Methodpeek_first
(&mut self)
1759. Find the Missing IDs/src/main.rs:39
Methodpermute
(nums: Vec<i32>)
46. Permutations/src/main.rs:8
Methodpermute_add
(permutation: &mut Vec<Vec<i32>>, elem: i32)
46. Permutations/src/main.rs:17
Functionpermute_add_basic
()
46. Permutations/src/main.rs:53
Methodpermute_once
(old: &Vec<String>, new: &mut Vec<String>, list: &Vec<&str>)
17. Letter Combinations of a Phone Number/src/main.rs:29
Methodpermute_unique
(mut nums: Vec<i32>)
47. Permutations II/src/main.rs:8
Methodplus_one
(mut digits: Vec<i32>)
66. Plus One/src/main.rs:8
Methodpop_line
(martrix: &mut Vec<Vec<i32>>, res: &mut Vec<i32>)
54. Spiral Matrix/src/main.rs:30
Methodproduct_except_self
use the output vector to achieve O(n) space
238. Product of Array Except Self/src/main.rs:9
MethodprojectionArea
O(n) extra space can optimize? can be optimized to O(1) space but iterate through the grid more than once
883. Projection Area of 3D Shapes/Solution.cpp:17
Methodprune_tree
(root: Option<Rc<RefCell<TreeNode>>>)
1669. Minimum Cost to Cut a Stick/src/main.rs:98
MethodquickSelect
l and r are both inclusive
215. Kth Largest Element in an Array/Solution.cpp:16
Methodrange_sum_bst
(root: Option<Rc<RefCell<TreeNode>>>, l: i32, r: i32)
Tree/938. Range Sum of BST/src/main.rs:28
MethodrankTeams
Weekly Contest 178/1366. Rank Teams by Votes/Solution.cpp:12
Methodrearrange_characters
(s: String, target: String)
2287. Minimum Number of Lines to Cover Points/src/lib.rs:4
MethodrecoverTree
99. Recover Binary Search Tree/Solution.cpp:46
Methodremove_duplicate_letters
(s: String)
316. Remove Duplicate Letters/src/main.rs:14
Methodremove_duplicates
(s: String)
704. 二分查找/src/main.rs:31
Methodremove_duplicates
(nums: &mut Vec<i32>)
26. Remove Duplicates from Sorted Array/src/main.rs:8
Methodremove_duplicates
(nums: &mut Vec<i32>)
80. Remove Duplicates from Sorted Array II/src/main.rs:10
Methodremove_duplicates_twopointer
(nums: &mut Vec<i32>)
80. Remove Duplicates from Sorted Array II/src/main.rs:22
Methodremove_element
(nums: &mut Vec<i32>, val: i32)
704. 二分查找/src/main.rs:992
Methodremove_element
(nums: &mut Vec<i32>, val: i32)
27. Remove Element/src/main.rs:8
Methodremove_element2
(nums: &mut Vec<i32>, val: i32)
704. 二分查找/src/main.rs:1006
Methodremove_elements
(head: Option<Box<ListNode>>, val: i32)
704. 二分查找/src/main.rs:687
Methodremove_elements2
(head: Option<Box<ListNode>>, val: i32)
704. 二分查找/src/main.rs:703
Methodremove_nth_from_end
(head: Option<Box<ListNode>>, n: i32)
704. 二分查找/src/main.rs:531
Methodremove_nth_from_end
(mut head: Option<Box<ListNode>>, n: i32)
19. Remove Nth Node From End of List/src/main.rs:50
Methodremove_nth_from_end
(mut head: Option<Box<ListNode>>, n: i32)
1669. Minimum Cost to Cut a Stick/src/main.rs:537
Methodremove_nth_from_end1
(mut head: Option<Box<ListNode>>, n: i32)
1669. Minimum Cost to Cut a Stick/src/main.rs:548
Methodremove_palindrome_sub
(s: String)
Weekly Contest 173/5319. Remove Palindromic Subsequences/src/main.rs:20
Methodremove_zero_sum_sublists
(mut head: Option<Box<ListNode>>)
1669. Minimum Cost to Cut a Stick/src/main.rs:220
Methodremove_zero_sum_sublists1
(mut head: Option<Box<ListNode>>)
1669. Minimum Cost to Cut a Stick/src/main.rs:245
Methodrepeated_character
(s: String)
2351. Number of Ways to Buy Pens and Pencils/src/lib.rs:4
Methodrepeated_substring_pattern
(s: String)
704. 二分查找/src/main.rs:178
Methodreplace_space
(s: String)
704. 二分查找/src/main.rs:290
Methodreverse
(x: i32)
7. Reverse Integer/src/main.rs:12
Methodreverse2
(s: &mut [char])
704. 二分查找/src/main.rs:245
Methodreverse_between
(head: Option<Box<ListNode>>, m: i32, n: i32)
92. Reverse Linked List II/src/main.rs:33
Methodreverse_k_group
(mut head: Option<Box<ListNode>>, k: i32)
1669. Minimum Cost to Cut a Stick/src/main.rs:320
Methodreverse_k_group
0 < k <= len, list is not empty
25. Reverse Nodes in k-Group/src/main.rs:38
Methodreverse_left_words
(s: String, n: i32)
704. 二分查找/src/main.rs:237
Methodreverse_list
(mut head: Option<Box<ListNode>>)
704. 二分查找/src/main.rs:571
Methodreverse_once
(mut head: Option<Box<ListNode>>, k: i32)
1669. Minimum Cost to Cut a Stick/src/main.rs:336
Methodreverse_str
(s: String, k: i32)
704. 二分查找/src/main.rs:314
Methodreverse_string
(s: &mut Vec<char>)
704. 二分查找/src/main.rs:331
Methodreverse_words
O(n) space O(n) time
704. 二分查找/src/main.rs:257
Methodrob
1 dp * 2 times equals to this question: the final result will only be one of the two following situations: - first is not selected, then freely select
213. House Robber II/src/main.rs:13
Methodrob
awsome solution : 0 ms
337. House Robber III/src/main.rs:32
Methodrob
1 dp
198. House Robber/src/main.rs:10
Methodrobb
return value (not robbed , robbed)
337. House Robber III/src/main.rs:38
Methodroman_to_int
(s: String)
13. Roman to Integer/src/main.rs:9
Methodrotate
(matrix: &mut Vec<Vec<i32>>)
48. Rotate Image/src/main.rs:21
Methodrotate_right
(mut head: Option<Box<ListNode>>, k: i32)
61. Rotate List/src/main.rs:32
Methods
(nums: & Vec<i32>, target: i32, start: usize, end: usize)
81. Search in Rotated Sorted Array II/src/main.rs:13
Methodsearch
(nums: Vec<i32>, target: i32)
704. 二分查找/src/main.rs:1025
Methodsearch
(nums: Vec<i32>, target: i32)
33. Search in Rotated Sorted Array/src/main.rs:9
Methodsearch
edge case n.size() == 0 buffer overflow : not exist case !!! two element !
81. Search in Rotated Sorted Array II/Solution.cpp:9
Methodsearch
I just wonder why i use recursive ? two complex
81. Search in Rotated Sorted Array II/src/main.rs:9
Methodsearch
(board: & Vec<Vec<char>>, word: &[char], i: usize, j: usize, used: &mut Vec<Vec<bool>>)
79. Word Search/src/main.rs:24
Methodsearch1
(nums: Vec<i32>, target: i32)
704. 二分查找/src/main.rs:1043
Methodsearch2
(nums: Vec<i32>, target: i32)
704. 二分查找/src/main.rs:1061
MethodsearchMatrix
240. Search a 2D Matrix II/Solution.cpp:15
Methodsearch_insert
(nums: Vec<i32>, target: i32)
35. Search Insert Position/src/main.rs:8
Methodsearch_matrix
(matrix: Vec<Vec<i32>>, target: i32)
74. Search a 2D Matrix/src/main.rs:8
Methodsearch_range
(nums: Vec<i32>, target: i32)
34. Find First and Last Position of Element in Sorted Array/src/main.rs:8
MethodsetZeroes
constant space
73. Set Matrix Zeroes/Solution.cpp:55
MethodsetZeroes1
straight forward version
73. Set Matrix Zeroes/Solution.cpp:11
MethodsetZeroes2
straight forward version
73. Set Matrix Zeroes/Solution.cpp:32
Methodshift_left
(s: String, shift: usize)
30-Day LeetCoding Challenge/Perform String Shifts/src/main.rs:28
Methodshortest_to_char
(s: String, c: char)
cn/821. 字符的最短距离/src/main.rs:10
Methodsingle_number
You should remember two things from this: x xor x = 0 0 xor x = x. Now you have two more xor properties you can use to solve problems. Good Luck!
136. Single Number/src/main.rs:12
Functionsmall
()
33. Search in Rotated Sorted Array/src/main.rs:52
MethodsmallerNumbersThanCurrent
Weekly Contest 178/1365. How Many Numbers Are Smaller Than the Current Number/Solution.cpp:10
Methodsolve
(board: &mut Vec<Vec<char>>, line: usize, ret: &mut Vec<Vec<String>>)
51. N-Queens/src/main.rs:17
Methodsolve
(board: &mut Vec<Vec<char>>)
37. Sudoku Solver/src/main.rs:29
Methodsolve
(board: &mut Vec<Vec<char>>, line: usize, ret: &mut i32)
52. N-Queens II/src/main.rs:16
Methodsolve_n_queens
(n: i32)
51. N-Queens/src/main.rs:8
Methodsolve_sudoku
(board: &mut Vec<Vec<char>>)
37. Sudoku Solver/src/main.rs:25
Methodsort_colors
[one..=two] (both inclusive) are unordered three pointers
Two Pointers/75. Sort Colors/src/main.rs:11
Methodsort_list
(mut head: Option<Box<ListNode>>)
1669. Minimum Cost to Cut a Stick/src/main.rs:287
MethodsortedListToBST
two pointers
109. Convert Sorted List to Binary Search Tree/Solution.cpp:30
← previousnext →1,001–1,100 of 1,163, ranked by callers