Given an unsorted array, find the minimum difference between any pair in given array. Examples : Input : {1, 5, 3, 19, 18, 25}; Output… Read More

# Category Archives: Arrays

Recently, VMWare has visited our campus for hiring interns and they have put a CGPA cut off of 7/10. There were 2 rounds in total.… Read More

Given a sorted array of positive integers, rearrange the array alternately i.e first element should be maximum value, second minimum value, third second max, fourth… Read More

Given an array of integers, count number of subarrays (of size more than one) that are strictly increasing. Expected Time Complexity : O(n) Expected Extra… Read More

Subarray/Substring A subbarray is a contiguous part of array. An array that is inside another array. For example, consider the array [1, 2, 3, 4],… Read More

Given a Binary Number as a string, print its 1’s and 2’s complements.1’s complement of a binary number is another binary number obtained by toggling… Read More

The longest Zig-Zag subsequence problem is to find length of the longest subsequence of given sequence such that all elements of this are alternating. If… Read More

Given a pattern containing only I’s and D’s. I for increasing and D for decreasing. Devise an algorithm to print the minimum number following that… Read More

Given a matrix of size M x N, there are large number of queries to find submatrix sums. Inputs to queries are left top and… Read More

Telephonic round: (1 hour) It is started with interviewer introduction followed by my introduction. Need to write the code in shared docs. They shared CollabEdit… Read More

Given an set of positive integers. find the maximum XOR subset value in the given set. Expected time complexity O(n). Examples: Input: set[] = {2,… Read More

We are given two sorted arrays. We need to merge these two arrays such that the initial numbers (after complete sorting) are in the first… Read More

1. Topological sort. 2. Reverse linked list in pairs. (1->2->3->4 to 2->1->4->3) 3. Print a binary tree in spiral order 4. Reverse an array without… Read More

Given two binary arrays arr1[] and arr2[] of same size n. Find length of the longest common span (i, j) where j >= i such… Read More

ROUND 1: First round was aptitude round, 10 question in 30 minute. Level of difficulty: easy. For each correct answer 2 marks will be awarded… Read More