📄️ Guidelines
Binary search implementation:
📄️ Binary Search
Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums...
📄️ Find Smallest Letter Greater Than Target
Return the smallest character in letters that is lexicographically greater than target. If such a character does not exist, return the first character in letters.
📄️ First Bad Version
Implement a function to find the first bad version. You should minimize the number of calls to the API.
📄️ Find Minimum in Rotated Sorted Array
Given the sorted rotated array nums of unique elements, return the minimum element of this array.
📄️ Search in Rotated Sorted Array
Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.
📄️ Search in Rotated Sorted Array II
Given the array nums after the rotation and an integer target, return true if target is in nums, or false if it is not in nums.
📄️ Peak Index in a Mountain Array
An array arr a mountain if the following properties hold...
📄️ Find Peak Element
A peak element is an element that is strictly greater than its neighbors.
📄️ Random Pick with Weight
You need to implement the function pickIndex(), which randomly picks an index in the range [0, w.length - 1] (inclusive) and returns it.
📄️ Time Based Key-Value Store
Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key's value at a certain timestamp.
📄️ Search a 2D Matrix
Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix.
📄️ Search a 2D Matrix II
Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix.
📄️ Find K Closest Elements
Given a sorted integer array arr, two integers k and x, return the k closest integers to x in the array.
📄️ Kth Smallest Element in a Sorted Matrix
Given an n x n matrix where each of the rows and columns is sorted in ascending order, return the kth smallest element in the matrix.
📄️ Count of Range Sum
Given an integer array nums and two integers lower and upper, return the number of range sums that lie in [lower, upper] inclusive.
📄️ Median of Two Sorted Arrays
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.