Home
Gaurav's GitHub Page
Cancel

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...

PRETTYPRINT (InterviewBit)

PROBLEM DESCRIPTION Print concentric rectangular pattern in a 2d matrix. Let us show you some examples to clarify what we mean. Example 1: Input: A = 4. Output: 4 4 4 4 4 4 4 4 3 3 3 3 3 4 4 ...

Divisible by 60 (InterviewBit)

PROBLEM DESCRIPTION Given a large number represent in the form of an integer array A, where each element is a digit. You have to find whether there exists any permutation of the array A such that ...

Excel Column Number (InterviewBit)

PROBLEM DESCRIPTION Given a column title A as appears in an Excel sheet, return its corresponding column number. SOLUTION public class Solution { public int titleToNumber(String A) { ...

Reverse integer (InterviewBit)

PROBLEM DESCRIPTION You are given an integer N and the task is to reverse the digits of the given integer. Return 0 if the result overflows and does not fit in a 32 bit signed integer. SOLUTION ...