Check if two arrays are equal or not

Given two given arrays of equal length, the task is to find if given arrays are equal or not. Two arrays are said to be equal if both of them contain same set of elements, arrangements (or permutation) of elements may be different though. Note : If there are repetitions, then counts of repeated elements… Read More »

Count all pairs of an array which differ in K bits

Given an array of size n and integer k, count all pairs in array which differ in exactly K bits of binary representation of both the numbers. The input arrays have elements with small values and possibly many repetitions. Input: arr[] = {2, 4, 1, 3, 1} k = 2 Output: 5 Explanation: There are… Read More »

Implementation of Deque using circular array

Deque or Double Ended Queue is a generalized version of Queue data structure that allows insert and delete at both ends.In previous post we had discussed introduction of deque. Now in this post we see how we implement deque Using circular array. Operations on Deque: Mainly the following four basic operations are performed on queue:… Read More »

Amazon Interview experience | Set 330

I recently gave interview for Amazon SDE-I role in Bangalore for AppStore team. Online Test (Hacker Earth): 1. Given a number N, you have to print “Prime” if its a prime number or “Not Prime” if its not. 2. Given a string S, print the number of digits and number of english alphabets in it.… Read More »