## Arrays Interview Questions

- 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++ - 8of 12 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 - 0of 0 votes

Answerssearch a number in a sorted array of the form

- rahul July 17, 2011

eg: 4 5 6 1 2 3

in O(logn).| Report Duplicate | Flag | PURGE

Microsoft Software Engineer / Developer Arrays - 0of 0 votes

AnswersGiven an infinite sorted array containings only 0 and 1 . Find the point where 0 to 1 transition happening....

- the_new_guy July 02, 2011| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Arrays - 0of 0 votes

AnswersYou are given a 1D array of integers, such as:

- Jara June 22, 2011

int[] array = [3,4,7,2,2,6,0,9];

Suppose you need to treat this array as a 2D table with a given number of rows.

You want to sum the columns of the table.

One value of numRows is 4..in that case the resultant array would look like

what if numRows==4?

3 4

7 2

2 6

0 9

—-

12 21| Report Duplicate | Flag | PURGE

Google Software Engineer / Developer Algorithm Arrays - 0of 0 votes

Answersgiven an array of integers S[], visualize it as a bar graph, with the index i as x coordinate and the S[i] as the y coordinate. and that the bars are shaded. find the largest rectangle, in the shaded bars.

- Apritha May 25, 2011| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Arrays - 0of 0 votes

Answersgiven two arrays A and B.

- Apritha May 25, 2011

A has integers unsorted.

B has the same length as A and its values are in the set {-1,0,1}

you have to return an array C with the following processing on A.

if B[i] has 0 then C[i] must have A[i]

if B[i] has -1 then A[i] must be in C within the sub array C[0] - C[i-1] ie. left subarray

if B[i] has 1 then A[i] must be in C within the sub array C[i+1] - C[length(A)] ie right subarray.

if no such solution exists then printf("no solution");| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Arrays

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window