Home
Gaurav's GitHub Page
Cancel

Amazing Subarrays (InterviewBit)

PROBLEM DESCRIPTION You are given a string A, and you have to find all the amazing substrings of A. An amazing Substring is one that starts with a vowel (a, e, i, o, u, A, E, I, O, U). Note: Take...

Longest Common Prefix (InterviewBit)

PROBLEM DESCRIPTION Given the array of strings A, you need to find the longest string S which is the prefix of ALL the strings in the array. Longest common prefix for a pair of strings S1 and S2 ...

Self Permutation (InterviewBit)

PROBLEM DESCRIPTION You are given two strings A and B. Check whether there exists any permutation of both A and B such that they are equal. Return a single integer 1 if its exists, 0 otherwise. ...

String And Its Frequency (InterviewBit)

PROBLEM DESCRIPTION Given a string A with lowercase english alphabets and you have to return a string in which, with each character its frequency is written in adjacent. SOLUTION public class So...

Deserialize (InterviewBit)

PROBLEM DESCRIPTION You are given a string A which is a serialized string. You have to restore the original array of strings. The string in the output array should only have lowercase english alp...

Different Bits Sum Pairwise (InterviewBit)

PROBLEM DESCRIPTION We define f(X, Y) as the number of different corresponding bits in the binary representation of X and Y. For example, f(2, 7) = 2, since the binary representation of 2 and 7 a...

XOR-ing the Subarrays! (InterviewBit)

PROBLEM DESCRIPTION Given an integer array A of size N. You need to find the value obtained by XOR-ing the contiguous subarrays, followed by XOR-ing the values thus obtained. Determine and return...

Min XOR value (InterviewBit)

PROBLEM DESCRIPTION Given an integer array A of N integers, find the pair of integers in the array which have minimum XOR value. Report the minimum XOR value. SOLUTION By sorting the array, we e...

Length of Last Word (InterviewBit)

PROBLEM DESCRIPTION Given a string s consists of upper/lower-case alphabets and empty space characters ‘ ‘, return the length of last word in the string. If the last word does not exist, return 0...

Reverse Bits (InterviewBit)

PROBLEM DESCRIPTION Reverse the bits of an 32 bit unsigned integer A. SOLUTION APPROACH 1 public class Solution { public long reverse(long a) { long res = 0; for(int i=0;...