You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 0864 |[Shortest Path to Get All Keys](src/main/kotlin/g0801_0900/s0864_shortest_path_to_get_all_keys/Solution.kt)| Hard | Breadth_First_Search, Bit_Manipulation | 176 | 100.00
| 0703 |[Kth Largest Element in a Stream](src/main/kotlin/g0701_0800/s0703_kth_largest_element_in_a_stream/KthLargest.kt)| Easy | Tree, Binary_Tree, Design, Heap_Priority_Queue, Binary_Search_Tree, Data_Stream | 286 | 95.45
1693
+
| 0701 |[Insert into a Binary Search Tree](src/main/kotlin/g0701_0800/s0701_insert_into_a_binary_search_tree/Solution.kt)| Medium | Tree, Binary_Tree, Binary_Search_Tree, Data_Structure_I_Day_13_Tree, Udemy_Tree_Stack_Queue | 311 | 79.03
1684
1694
| 0700 |[Search in a Binary Search Tree](src/main/kotlin/g0601_0700/s0700_search_in_a_binary_search_tree/Solution.kt)| Easy | Tree, Binary_Tree, Binary_Search_Tree, Data_Structure_I_Day_13_Tree | 251 | 88.31
| 0698 |[Partition to K Equal Sum Subsets](src/main/kotlin/g0601_0700/s0698_partition_to_k_equal_sum_subsets/Solution.kt)| Medium | Array, Dynamic_Programming, Bit_Manipulation, Backtracking, Bitmask, Memoization | 191 | 100.00
You are given the `root` node of a binary search tree (BST) and a `value` to insert into the tree. Return _the root node of the BST after the insertion_. It is **guaranteed** that the new value does not exist in the original BST.
6
+
7
+
**Notice** that there may exist multiple valid ways for the insertion, as long as the tree remains a BST after insertion. You can return **any of them**.
Design a class to find the <code>k<sup>th</sup></code> largest element in a stream. Note that it is the <code>k<sup>th</sup></code> largest element in the sorted order, not the <code>k<sup>th</sup></code> distinct element.
6
+
7
+
Implement `KthLargest` class:
8
+
9
+
*`KthLargest(int k, int[] nums)` Initializes the object with the integer `k` and the stream of integers `nums`.
10
+
*`int add(int val)` Appends the integer `val` to the stream and returns the element representing the <code>k<sup>th</sup></code> largest element in the stream.
11
+
12
+
**Example 1:**
13
+
14
+
**Input**
15
+
16
+
["KthLargest", "add", "add", "add", "add", "add"]
17
+
[[3, [4, 5, 8, 2]], [3], [5], [10], [9], [4]]
18
+
19
+
**Output:**[null, 4, 5, 5, 8, 8]
20
+
21
+
**Explanation:**
22
+
23
+
KthLargest kthLargest = new KthLargest(3, [4, 5, 8, 2]);
Given an array of integers `nums` which is sorted in ascending order, and an integer `target`, write a function to search `target` in `nums`. If `target` exists, then return its index. Otherwise, return `-1`.
6
+
7
+
You must write an algorithm with `O(log n)` runtime complexity.
8
+
9
+
**Example 1:**
10
+
11
+
**Input:** nums = [-1,0,3,5,9,12], target = 9
12
+
13
+
**Output:** 4
14
+
15
+
**Explanation:** 9 exists in nums and its index is 4
16
+
17
+
**Example 2:**
18
+
19
+
**Input:** nums = [-1,0,3,5,9,12], target = 2
20
+
21
+
**Output:** -1
22
+
23
+
**Explanation:** 2 does not exist in nums so return -1
0 commit comments