Arrays Interview Questions
- 0of 0 votes
AnswersSearch an element in a 3-D sorted array without modifying the given array.
- Mike February 12, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 0of 0 votes
AnswersQ:Given an input array of unsorted elements, sort the array using binary search technique.
- sriniatiisc February 04, 2012 in India
A: Build a bst out of the unsorted array by looping over the array and inserting each element to the tree.
Once you have the bst do inorder traversal.| Report Duplicate | Flag | PURGE
Myntra.com Software Engineer / Developer Arrays - 0of 0 votes
AnswersGvien an array of integers return the integers that are greater than the avegare of that array
- adevisetti February 04, 2012 in United Statesint[] GeraterthanAverage(int[] a)
| Report Duplicate | Flag | PURGE
Expedia Arrays - 0of 0 votes
AnswersGet the top 3 frequently used words in a book. The book contents are given as a single text file.
- anon.guy January 31, 2012 in United States for Kindle
I used hashmap solution. The interviewer said its not optimal. Use a combination of two or three data struct.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays Coding Data Structures - 0of 0 votes
Answersyou have 100 elements from 1 to 100 but my mistake one of those number overlapped another by repeating itself.
- Interviews January 29, 2012 in India
Ex. in 1----98,99,100 .... 99 overwrite 2 , so the array becomes ... 1,99,3,4,----99,100 .. Array is not in sorted format , how to find the repeating number ?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 0of 0 votes
AnswersAn unsorted array contains elemets 1-1000, we are replacing one element in the array with n , and n is greater than 1000. How can we find out what element got replaced with n
- sanoj January 16, 2012 in India| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm Arrays Coding Java - 0of 0 votes
AnswersA sequence of numbers is called a zig-zag sequence if the differences
- topcoder99 December 16, 2011 in India
between successive numbers strictly alternate between positive and
negative. The first difference (if one exists) may be either positive
or negative. A sequence with fewer than two elements is trivially a
zig-zag sequence.
For example, 1,7,4,9,2,5 is a zig-zag sequence because the differences
(6,-3,5,-7,3) are alternately positive and negative. In contrast,
1,4,7,2,5 and 1,7,4,5,5 are not zig-zag sequences, the first because
its first two differences are positive and the second because its last
difference is zero.
Given a sequence of integers, sequence, return the length of the
longest subsequence of sequence that is a zig-zag sequence. A
subsequence is obtained by deleting some number of elements (possibly
zero) from the original sequence, leaving the remaining elements in
their original order| Report Duplicate | Flag | PURGE
Amazon Arrays - 0of 0 votes
AnswersHow to rotate the array with o(n) or o(nlogn)/
- JobHunter November 11, 2011 in United States
eg) A[]={A,B,C,D,E} rotate Index - 2
It should be {C,D,E,A,B}| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Arrays - 0of 0 votes
AnswersQuestion 3)
- msankith October 30, 2011 in -
Given an crypted array obtain the original text . Should be implemented without extra space .
Eg: Crypt array : a3b4c3
decrypt array : aaabbbbccc
Imagine the array contains sufficient memory to hold the decrypt ?| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer Arrays - 0of 0 votes
AnswersFind numbers in an array that sum to a certain number....Once number is found return the index of both the numbers...We are not allowed to use Hashmap or any other DS...we have to do it inplace...using the same array
- vran.freelancer October 25, 2011 in United States for ERP solution| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Arrays - 0of 0 votes
AnswersGiven an Array A={-2,4,30,-50,90,-60,100,120}
- cmsuraj007 October 20, 2011 in United States
The array index represents time of day.
Say 0-9 A.M, 1- 10 A.M....etc
And value represents stock price at that time.
Get the max profit. i.e in this input,
best buying price=-60
best selling price=120| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer Arrays - 0of 0 votes
AnswersFind the maximum continuous sum in an array. The array will contain at least one positive integer. Report the actual sequence. If there are multiple sequences report any one.
- python.c.madhav October 15, 2011 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Arrays Coding - 0of 0 votes
Answersremove duplicates in an array.
- Avinash October 15, 2011 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 0of 0 votes
AnswersGiven a 2D array which has elements sorted both row-wise and column wise, find an efficient way to search a given key.
- Avinash October 15, 2011 in India
Ex: a1 a2 a3 a4
b1 b2 b3 b4
c1 c2 c3 c4
a1<a2<a3<a4 (for all rows)
a1<b1<c1 (for all columns)| Report Duplicate | Flag | PURGE
Amazon Goldman Sachs Software Engineer / Developer Applications Developer Arrays C++ - 11of 15 votes
AnswersGiven an int array which might contain duplicates, find the largest subset of it which form a sequence.
- learner October 06, 2011 in -
Eg. {1,6,10,4,7,9,5}
then ans is 4,5,6,7
Sorting is an obvious solution. Can this be done in O(n) time| Report Duplicate | Flag | PURGE
Google Software Engineer in Test Software Engineer / Developer Arrays Algorithm - 0of 0 votes
AnswersGiven a array,find out if there exist a subarray such its sum is zero.
- abc September 23, 2011 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - -1of 1 vote
Answersafter the memory allocated then we can removed elements from any where in the list
- rahul.singh0089 September 20, 2011 in India| Report Duplicate | Flag | PURGE
Wipro Technologies Software Engineer / Developer Arrays - 0of 0 votes
AnswersIt is my first phone screening, it consists of two questions , first question was pretty simple
- tylerDurden September 15, 2011 in India for Data Storage
Q1:WAP to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum.
My Soluton :Kadane’s Algorithm:
int maxSubArraySum(int a[], int size)
{
int max_so_far = 0, max_ending_here = 0;
int i;
for(i = 0; i < size; i++)
{
max_ending_here = max_ending_here + a[i];
if(max_ending_here < 0)
max_ending_here = 0;
if(max_so_far < max_ending_here)
max_so_far = max_ending_here;
}
return max_so_far;
}| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 1of 1 vote
AnswersGiven a big unsorted list of 64-bit integers, find an element not in list
- novice September 15, 2011 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 0of 0 votes
AnswersIn an array find out the nth maximum number.
- dheeraj2311 August 06, 2011| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Arrays - 0of 0 votes
AnswersGiven a sorted array, output all triplets <a,b,c> such that a-b = c. Expected time is O(n^2). My approach using binary search took O(n^2 logn). When you attempt an approach, test your code with this example and list your outputs for verification. Thanks.
- anonymous August 04, 2011
-12, -7, -4, 0, 3, 5, 9, 10, 15, 16| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Arrays - 0of 0 votes
AnswersRound2: Q2
- Ray July 20, 2011
Given a array find the sub array with maximum sum.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 0of 0 votes
AnswersRound 2: Q1:
- Abee July 20, 2011
Given 2 unsorted arrays, find the intersection of the two arrays (optimal soln).
He was asking for various approaches and complexity in all those approaches.
Finally, he was interested in the solution using array-sorting.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 0of 0 votes
AnswersRound 1: Q1:
- Abee July 20, 2011
Given a matrix, print it spirally.
Input:
1 2 3
4 5 6
7 8 9
Output: 1 2 3 6 9 8 7 4 5| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays