Home
Gaurav's GitHub Page
Cancel

Painter's Partition Problem (InterviewBit)

PROBLEM DESCRIPTION Given 2 integers A and B and an array of integers C of size N. Element C[i] represents the length of ith board. You have to paint all N boards [C0, C1, C2, C3 … CN-1]. There ar...

Rotated Sorted Array Search (InterviewBit)

PROBLEM DESCRIPTION Given an array of integers A of size N and an integer B. array A is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2 ). You are...

Allocate Books (InterviewBit)

PROBLEM DESCRIPTION Given an array of integers A of size N and an integer B. The College library has N books. The ith book has A[i] number of pages. You have to allocate books to B number of stu...

Capacity To Ship Packages Within B Days (InterviewBit)

PROBLEM DESCRIPTION A conveyor belt has packages that must be shipped from one port to another within B days. The ith package on the conveyor belt has a weight of A[i]. Each day, we load the ship...

Square Root of Integer (InterviewBit)

PROBLEM DESCRIPTION Given an integer A. Compute and return the square root of A. If A is not a perfect square, return floor(sqrt(A)). DO NOT USE SQRT FUNCTION FROM STANDARD LIBRARY. NOTE: Do n...

Search in Bitonic Array! (InterviewBit)

PROBLEM DESCRIPTION Given a bitonic sequence A of N distinct elements, write a program to find a given element B in the bitonic sequence in O(logN) time. NOTE: A Bitonic Sequence is a sequence o...

Search for a Range (InterviewBit)

PROBLEM DESCRIPTION Given a sorted array of integers A (0 based index) of size N, find the starting and the ending position of a given integer B in array A. Your algorithm’s runtime complexity mu...

Matrix Search (InterviewBit)

PROBLEM DESCRIPTION Given a matrix of integers A of size N x M and an integer B. Write an efficient algorithm that searches for integer B in matrix A. This matrix A has the following properties: ...

Sorted Insert Position (InterviewBit)

PROBLEM DESCRIPTION Given a sorted array A and a target value B, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume n...

Smaller or equal elements (InterviewBit)

PROBLEM DESCRIPTION Given an sorted array A of size N. Find number of elements which are less than or equal to B. NOTE: Expected Time Complexity O(log N) SOLUTION public class Solution { p...