MCPcopy Create free account

hub / github.com/Aloxaf/LeetCode-Rust / functions

Functions279 in github.com/Aloxaf/LeetCode-Rust

Methodlevel
(op: u8)
src/basic_calculator_ii.rs:4
Methodlevel_order
(root: Option<Rc<RefCell<TreeNode>>>)
src/binary_tree_level_order_traversal.rs:6
Methodlevel_order_bottom
(root: Option<Rc<RefCell<TreeNode>>>)
src/binary_tree_level_order_traversal_ii.rs:6
Methodlongest_common_prefix
(strs: Vec<String>)
src/longest_common_prefix.rs:2
Methodlongest_palindrome
(s: String)
src/longest_palindromic_substring.rs:20
Methodmajority_element
摩尔投票算法
src/majority_element.rs:3
Methodmajority_element
(nums: Vec<i32>)
src/majority_element_ii.rs:2
Methodmax_depth
(root: Option<Rc<RefCell<TreeNode>>>)
src/maximum_depth_of_binary_tree.rs:6
Methodmax_sub_array
(nums: Vec<i32>)
src/maximum_subarray.rs:2
Methodmerge
(nums1: &mut Vec<i32>, m: i32, nums2: &mut Vec<i32>, n: i32)
src/merge_sorted_array.rs:2
Methodmerge_k_lists
基本思路, 存 Vec 里排序 本来准备用优先队列, 想了想感觉也没简单多少? 后来我还是用了优先队列, 因为发现用 std::cmp::Reverse 可以方便地逆转大小关系
src/merge_k_sorted_lists.rs:23
Methodmerge_two_lists
( mut l1: Option<Box<ListNode>>, mut l2: Option<Box<ListNode>>, )
src/merge_two_sorted_lists.rs:6
Methodmy_atoi
(str: String)
src/string_to_integer_atoi.rs:2
Methodmy_pow
(mut x: f64, mut n: i32)
src/powx_n.rs:2
Methodmy_pow_bit
(mut x: f64, mut n: i32)
src/powx_n.rs:17
Methodmy_pow_builtin
(x: f64, n: i32)
src/powx_n.rs:41
Methodmy_pow_normal
(mut x: f64, mut n: i32)
src/powx_n.rs:33
Methodmy_sqrt
(x: i32)
src/sqrtx.rs:2
Methodnew
(key: i32, val: i32)
src/design_hashmap.rs:30
Methodnew
Initialize your data structure here. */
src/add_and_search_word_data_structure_design.rs:15
Methodnew
initialize your data structure here. */
src/min_stack.rs:16
Methodnew
Initialize your data structure here. */
src/implement_trie_prefix_tree.rs:9
Methodnew
Initialize your data structure here. */
src/implement_queue_using_stacks.rs:17
Methodnew
Initialize your data structure here. */
src/implement_stack_using_queues.rs:17
Methodnew
(val: i32)
src/design_linked_list.rs:20
Functionnormal
()
src/powx_n.rs:60
Methodnum_jewels_in_stones
(j: String, s: String)
src/jewels_and_stones.rs:2
Methodnum_unique_emails
(emails: Vec<String>)
src/unique_email_addresses.rs:4
Methodpair
(c: u8)
src/valid_parentheses.rs:3
Methodpermute
(nums: Vec<i32>)
src/permutations.rs:6
Methodplus_one
(mut digits: Vec<i32>)
src/plus_one.rs:2
Methodpop
Removes the element on top of the stack and returns that element. */
src/implement_stack_using_queues.rs:31
Functionpop_insert
(b: &mut Bencher)
src/rotate_array.rs:63
Functionpq
()
src/kth_largest_element_in_an_array.rs:35
Methodproduct_except_self
assume that nums = [a, b, c, d, e] pass1: nums = [1, a, ab, abc, abcd] pass2: nums = [bcde, cde, de, e, 1] pass1 * pass2: nums = [bcde, acde, abde, ab
src/product_of_array_except_self.rs:6
Methodpush
Push element x onto stack. */
src/implement_stack_using_queues.rs:22
Methodput
value will always be non-negative. */
src/design_hashmap.rs:120
Functionrecursive
()
src/same_tree.rs:42
Functionrecursive
()
src/symmetric_tree.rs:54
Methodremove
Removes the mapping of the specified value key if this map contains a mapping for the key */
src/design_hashmap.rs:138
Methodremove_duplicates
(nums: &mut Vec<i32>)
src/remove_duplicates_from_sorted_array.rs:2
Methodremove_element
(nums: &mut Vec<i32>, val: i32)
src/remove_element.rs:2
Methodremove_elements
(mut head: Option<Box<ListNode>>, val: i32)
src/remove_linked_list_elements.rs:4
Methodremove_nth_from_end
啊! 要被 borrow checker 逼疯了
src/remove_nth_node_from_end_of_list.rs:5
Methodreverse_k_group
https://leetcode.com/problems/reverse-nodes-in-k-group/discuss/11423/Short-but-recursive-Java-code-with-comments
src/reverse_nodes_in_k_group.rs:5
Methodreverse_list
(head: Option<Box<ListNode>>)
src/reverse_linked_list.rs:4
Methodreverse_string
(s: String)
src/reverse_string.rs:2
Methodreverse_string_unsafe
这都不是最快? 第一的大佬究竟用了什么黑魔法...
src/reverse_string.rs:7
Methodroman_to_int
(s: String)
src/roman_to_integer.rs:2
Methodrotate
(matrix: &mut Vec<Vec<i32>>)
src/rotate_image.rs:2
Methodrotate
(nums: &mut Vec<i32>, k: i32)
src/rotate_array.rs:2
Methodrotate_builtin
符合要求, 但是跟 cheat 一样 (
src/rotate_array.rs:16
Methodrotate_drain_append
不符合要求的代码 (不过快一点
src/rotate_array.rs:10
Methodrotate_right_safe
(mut head: Option<Box<ListNode>>, mut k: i32)
src/rotate_list.rs:42
Functionsafe
(b: &mut Bencher)
src/rotate_list.rs:134
Methodsearch
Returns if the word is in the data structure. A word could contain the dot character '.' to represent any one letter. */
src/add_and_search_word_data_structure_design.rs:36
Methodsearch
Returns if the word is in the trie. */
src/implement_trie_prefix_tree.rs:43
Methodsearch_insert
(nums: Vec<i32>, target: i32)
src/search_insert_position.rs:2
Methodsearch_range
(nums: Vec<i32>, target: i32)
src/find_first_and_last_position_of_element_in_sorted_array.rs:3
Methodsearch_range_builtin
(nums: Vec<i32>, target: i32)
src/find_first_and_last_position_of_element_in_sorted_array.rs:39
Methodself_dividing_numbers
(left: i32, right: i32)
src/self_dividing_numbers.rs:2
Methodsingle_number
(nums: Vec<i32>)
src/single_number.rs:2
Functionsort
()
src/kth_largest_element_in_an_array.rs:30
Methodsort_array_by_parity
简单粗暴 (
src/sort_array_by_parity.rs:3
Methodspiral_order
(matrix: Vec<Vec<i32>>)
src/spiral_matrix.rs:2
Methodstarts_with
Returns if there is any word in the trie that starts with the given prefix. */
src/implement_trie_prefix_tree.rs:48
Methodstr_str
(haystack: String, needle: String)
src/implement_strstr.rs:2
Methodstr_str_bf
发现暴力也能 0ms 过, 还以为要 KMP. 想想也是....毕竟是简单题
src/implement_strstr.rs:10
Methodsubsets
(nums: Vec<i32>)
src/subsets.rs:2
Methodswap_pairs
(mut head: Option<Box<ListNode>>)
src/swap_nodes_in_pairs.rs:4
Functiontest
()
src/maximum_subarray.rs:22
Functiontest
()
src/majority_element.rs:26
Functiontest
()
src/reverse_string.rs:23
Functiontest
()
src/single_number.rs:14
Functiontest
()
src/self_dividing_numbers.rs:23
Functiontest
()
src/two_sum_ii_input_array_is_sorted.rs:25
Functiontest
()
src/add_strings.rs:34
Functiontest
()
src/remove_duplicates_from_sorted_array.rs:22
Functiontest
()
src/permutations.rs:27
Functiontest
()
src/basic_calculator_ii.rs:62
Functiontest
()
src/roman_to_integer.rs:36
Functiontest
()
src/unique_morse_code_words.rs:24
Functiontest
()
src/remove_element.rs:23
Functiontest
()
src/rotate_image.rs:24
Functiontest
()
src/longest_substring_without_repeating_characters.rs:23
Functiontest
()
src/sqrtx.rs:21
Functiontest
()
src/remove_linked_list_elements.rs:27
Functiontest
()
src/swap_nodes_in_pairs.rs:34
Functiontest
()
src/spiral_matrix.rs:33
Functiontest
()
src/valid_sudoku.rs:72
Functiontest
()
src/asteroid_collision.rs:33
Functiontest
()
src/majority_element_ii.rs:39
Functiontest
()
src/add_and_search_word_data_structure_design.rs:72
Functiontest
()
src/flatten_binary_tree_to_linked_list.rs:34
Functiontest
()
src/search_insert_position.rs:15
Functiontest
()
src/implement_strstr.rs:33
Functiontest
()
src/count_primes.rs:23
Functiontest
()
src/to_lower_case.rs:14
Functiontest
()
src/count_and_say.rs:36
Functiontest
()
src/valid_parentheses.rs:33
← previousnext →101–200 of 279, ranked by callers