Tag: binary search algorithm
A binary matrix means that all elements are 0 or 1. For each individual row of the matrix, this row is sorted in non-decreasing order. Given a row-sorted binary …
Given the array nums, for each nums find out how many numbers in the array are smaller than it. That is, for each nums you have to count the …
Given an array of integers nums and an integer threshold, we will choose a positive integer divisor and divide all the array by it and sum the result of …
Given a function f(x, y) and a value z, return all positive integer pairs x and y where f(x,y) == z. The function is constantly increasing, i.e.: f(x, y) …
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. You may assume k is always valid, 1 ≤ k ≤ BST’s …