Home
Gaurav's GitHub Page
Cancel

Find Permutation (InterviewBit)

PROBLEM DESCRIPTION Given a positive integer n and a string s consisting only of letters D or I, you have to find any permutation of first n positive integer that satisfy the given input string. ...

Next Permutation (InterviewBit)

PROBLEM DESCRIPTION Implement the next permutation, which rearranges numbers into the numerically next greater permutation of numbers for a given array A of size N. If such an arrangement is not ...

Rotate Matrix (InterviewBit)

PROBLEM DESCRIPTION You are given a N x N 2D matrix A representing an image. Rotate the image by 90 degrees (clockwise). You need to do this in place. Update the given matrix A. InterviewBit S...

Largest Number (InterviewBit)

PROBLEM DESCRIPTION Given a list of non-negative integers, arrange them such that they form the largest number. Note: The result may be very large, so you need to return a string instead of an int...

Sort array with squares! (InterviewBit)

PROBLEM DESCRIPTION Given a sorted array A containing N integers both positive and negative. You need to create another array containing the squares of all the elements in A and return it in non-...

Pigeonhole Sort

PIGEONHOLE SORT Suitable for sorting integers within a small range when the distribution of values is relatively uniform. The time complexity of Pigeonhole Sort is O(n + Range), ...

Maximum Consecutive Gap (InterviewBit)

PROBLEM DESCRIPTION Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains less than 2 elements. -You may assume t...

Balance Array (InterviewBit)

PROBLEM DESCRIPTION Given an integer array A of size N. You need to count the number of special elements in the given array. A element is special if removal of that element make the array balance...

Find Duplicate in Array (InterviewBit)

PROBLEM DESCRIPTION Given a read-only array of n + 1 integers between 1 and n, find one number that repeats in linear time using less than O(n) space and traversing the stream sequentially O(1) ti...

Triplets with Sum between given range (InterviewBit)

PROBLEM DESCRIPTION Given an array of real numbers greater than zero in form of strings. Find if there exists a triplet (a,b,c) such that 1 < a+b+c < 2. Return 1 for true or 0 for false. O(...