check-if-all-characters-have-equal-number-of-occurrences check-if-array-is-sorted-and-rotated check-if-binary-string-has-at-most-one-segment-of-ones check-if-it-is-a-good-array check-if-n-and-its-double-exist check-if-number-has-equal-digit-count-and-digit-value check-if-numb...
> All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself. > > For example, > Given "egg", "add", return true. > > Given "foo", "bar", return...
Substring with Concatenation of All Words 33. Search in Rotated Sorted Array 34. Find First and Last Position of Element in Sorted Array 35. Search Insert Position 36. Valid Sudoku 37. Sudoku Solver 39. Combination Sum 40. Combination Sum II 41. First Missing Positive 42. Trapping Rain ...
1207 Unique Number of Occurrences 72.40% Easy 1206 Design Skiplist 59.60% Hard 1205 Monthly Transactions II * 45.30% Medium 1204 Last Person to Fit in the Bus * 73.00% Medium 1203 Sort Items by Groups Respecting Dependencies 48.80% Hard 1202 Smallest String With Swaps 50.50% Medium 1201 Ugly ...
28 Find the Index of the First Occurrence in a String Easy JavaScript TypeScript 29 Divide Two Integers Medium JavaScript 31 Next Permutation Medium Rust 32 Longest Valid Parentheses Hard Go 34 Find First and Last Position of Element in Sorted Array Medium JavaScript Go 35 Search Insert Position...
(Note that because the prison is a row, the first and the last cells in the row can't have two adjacent neighbors.) We describe the current state of the prison in the following way: cells[i] == 1 if the i-th cell is occupied, else cells[i] == 0. ...
34 Find First and Last Position of Element in Sorted Array 27.50% Medium 33 Search in Rotated Sorted Array 28.80% Hard 32 Longest Valid Parentheses 20.90% Hard 31 Next Permutation 25.00% Medium 30 Substring with Concatenation of All Words 19.40% Hard 29 Divide Two Integers 15.00% Medium 28 ...
1.Add and Search Word.javaLevel: Medium Trie结构, prefix tree的变形: '.'可以代替任何字符,那么就要iterate这个node所有的children. 节点里面有char, isEnd, HashMap<Character, TrieNode> Build trie = Insert word:没node就加,有node就移动。
class Solution { public int[] topKFrequent(int[] nums, int k) { Map<Integer, Integer> occurrences = new HashMap<Integer, Integer>(); for (int num : nums) { occurrences.put(num, occurrences.getOrDefault(num, 0) + 1); } // int[] 的第一个元素代表数组的值,第二个元素代表了该值出...
104. 34 Find First and Last Position of Element in Sorted Array - Leetcode in G 12:16 105. 33 Search in Rotated Sorted Array - Leetcode in Go - Binary search 10:30 106. 35 Search Insert Position - Leetcode in Go - Binary search 找左界 10:40 107. 744. Find Smallest Letter...