Arrays Interview Questions
- 0of 0 votes
Answersgiven an array find the set of consecutive numbers which gives the maximum sum
- geeksavy May 15, 2012 in India
I/P 1 3 -5 15 1 11 -15 18
o/p : 15+1+11 gives the maximum sum
the code should return 15,1,11
can u tell me the logic??
Thanks in advance| Report Duplicate | Flag | PURGE
Arrays - 0of 0 votes
AnswersQ2. F2F Round-1, Amazon(Bangalore)
- Nitin Gupta May 12, 2012 in India
Given an array of integers having the property that first that array is strictly increasing then it is strictly decreasing, You have to search for a given number.
Constraint: Minimize the complexity| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays C C# C++ Coding Data Structures Java - 0of 0 votes
AnswersQ1. F2F Round 1 Amazon(Bangalore)
- Nitin Gupta May 12, 2012 in India
Given a character array as input. Array contains only three types of characters 'R', 'G' and 'B'. Sort the array such that all 'R's comes before 'G's and all 'G's comes before 'B's.
Constraint :- No extra space allowed(except O(1) space like variables) and minimize the time complexity.
You can only traverse the array once.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays C C# C++ Coding Data Structures Java Sorting - 0of 0 votes
AnswersQ4. Written Exam Amazon(Bangalore)
- Nitin Gupta May 12, 2012 in India
Given an array of integers A[1....n-1] where 'N' is the length of array A[ ]. Construct an array B such that B[i] = min(A[i], A[i+1], ......., A[i-K+1]), where K will be given.
Array B will have N-K+1 elements.
Constraint: Extra space allowed O(K) and time complexity allowed O(N.K) or lower.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays C C# C++ Coding Data Structures Java Sorting - 0of 0 votes
Answersimplement java code which takes aA1Bbc2@C3 as input and prints abcABC@6 as output
- kiran May 08, 2012 in India| Report Duplicate | Flag | PURGE
Developer Program Engineer Arrays - 0of 0 votes
AnswersImplement JAVA code which takes 2 dimensional integer array as input and prints out heaviest island.
- kiran May 04, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 0of 0 votes
AnswersReverse an array without using iteration.
- KaranGoswamiKenZ May 02, 2012 in United States for Firmware
Hint: Recursion.| Report Duplicate | Flag | PURGE
Intel Software Engineer / Developer Arrays - 0of 0 votes
AnswersWrite functions for insertion and deletion in a circular queue implemented using an array in C.
- KaranGoswamiKenZ May 02, 2012 in United States for Firmware
Hint: Remove the node from the end.
Add a node in the front. Move the pointer for removal and insertion. Pointer is just a counter for the index. Modulus it by size of array so that it circles from 0-n.
When pointers match , array is full.| Report Duplicate | Flag | PURGE
Intel Software Engineer / Developer Arrays - 0of 0 votes
AnswersGiven a 2D array of 1's and 0's, find the size of the largest block of 0's. For example the following 2D array:
int[][] array = { {1, 0, 1, 0, 0, 0, 1, 0 } {1, 0, 0, 0, 0, 0, 1, 1 } {1, 1, 1, 0, 0, 0, 1, 1 } }
Would return "9", because there is a 3x3 square of 0's, and that is the biggest block of 0's in the 2D space.
- Ash April 25, 2012 in United States| Report Duplicate | Flag | PURGE
Algorithm Arrays - 1of 1 vote
AnswersFind the all the sequence from Unsorted array.
- amitnagar21 April 23, 2012 in India
Example : {2,4,6,8,10,14,11,12,15,7} is the unsorted array. We have to find out possible sequences.
Output would be :
Seq 1 : {2,4,6,8,10,11,12,15}
Seq 2 : {2,4,6,8,10,14,15}
Note : if I pick any element in array than next element would be grater than the previous element.| Report Duplicate | Flag | PURGE
Amazon Arrays - -1of 1 vote
Answersprint 2n+1 prime numbers if any one of them not prime then print factors for that number
- Anonymous April 21, 2012 in India| Report Duplicate | Flag | PURGE
Facebook Developer Program Engineer Arrays C Coding - -1of 1 vote
Answerswrite a program to print the given string as alphabets in order next integres fallowed by sum
- Anonymous April 21, 2012 in India
example: CAE2W3A is input and output should be
ACDEW5| Report Duplicate | Flag | PURGE
Facebook Developer Program Engineer Arrays Coding - 1of 1 vote
AnswersDifference between array and linked list
- DJ March 31, 2012 in United States| Report Duplicate | Flag | PURGE
NVIDIA Intern Arrays - 1of 1 vote
Answerswrite a program to find whether the string is palindrome or not.
- bhargav March 30, 2012 in United States| Report Duplicate | Flag | PURGE
Expedia Java Developer Algorithm Arrays Java - 1of 1 vote
Answerswrite a function to rotate an m x n array by 90 degrees
- popoff March 20, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 1of 1 vote
AnswersPush all the zero's of a given array to the end of the array. In place only. Ex 1,2,0,4,0,0,8 becomes 1,2,4,8,0,0,0
- CheckThisResume.com March 09, 2012 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm Arrays C Coding - 0of 0 votes
AnswersGiven a 2D array, all rows and all columns sorted. Find an integer x from the 2D array.
- KSS March 09, 2012 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays - 1of 1 vote
AnswersGiven 2 Arrays A and B, find the intersection of two arrays. Initially without using any other data structure. Later with using additional data structure.
- KSS March 09, 2012 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays - 0of 0 votes
AnswersGiven an Array With random 0s and non 0 numbers, shift all the 0s to the beginning and non 0s to the rear.
- soundararajanaravind March 06, 2012 in India
Eg: 1,9,8,4,0,0,2,7,0,6,0
Out put 0,0,0,0,1,9,8,4,2,7,6
i.e order of numbers not to change. Do it in place| Report Duplicate | Flag | PURGE
Microsoft Student student Arrays - 0of 0 votes
AnswersGiven an array. Find pairs of numbers that add up to a given value 'x'. with time complexity less than O(n2) and use no additional space.
- varsha March 06, 2012 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 1of 1 vote
AnswersGiven a sorted array that is sorted by rotated, find a given number. For example take an array: 1 3 8 10 12 56 and rotate it so you have 10 12 56 1 3 8 and then find a candidate e.g. 3 in it.
- ashish.kaila March 05, 2012 in United States| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Arrays - 0of 0 votes
AnswersGiven a string representing sorted numbers with spaces print the count of each number. For example if the input string is: "1 1 2 3 4 4" then you should print 1:2, 2:1, 3:1, 4:2
- ashish.kaila March 05, 2012 in United States
Then the question was modified so there could be invalid number in the string which must be skipped.
Then an added requirement to handle hex numbers in the string.| Report Duplicate | Flag | PURGE
Twitter Software Engineer / Developer Arrays - 0of 0 votes
AnswersSuppose you have given a 10 digit mobile number (9903457235). Each digit in the number have 3 letters in mobile keypad. find/print all words which can be created by corresponding letter against digit given.. Total 3^10 words, I need complete recursive function.
- Sanjay Kumar March 04, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Arrays - 0of 0 votes
AnswersGiven you have an array A[1..n] of size n, it contains elements from the set {1..n}. However, two of the elements are missing, (and perhaps two of the array elements are repeated). Find the missing elements.
- Krupa February 29, 2012 in India
Eg if n=5, A may be A[5] = {1,2,1,3,2}; and so the missing elements are {4,5}
The interviewer was looking for less than o(n) solutions.
Hash map,bit vector or traversal over the array weren't accepted.
Optimized solutions please| Report Duplicate | Flag | PURGE
Arrays - 0of 0 votes
AnswersFind all such number in a matrix if maximum of the row and minimum of the column is same number.
- Gaurav February 29, 2012 in India| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Arrays - 0of 0 votes
Answerswrite a program to print the given string as alphabets in order next integres with sum next special characters
- kiran February 29, 2012 in India
example: CAE2W3@D# as input and output should be
ACDEW5@#| Report Duplicate | Flag | PURGE
Sapient Corporation Developer Program Engineer Arrays - 0of 0 votes
Answerswrite a program to print checksum for given number
- kiran February 29, 2012 in India
by taking last digit sapeate and if sum of squares of remaining numbers are equal to previous last number then print valid checksum else invalid
example: 321543 take 3 saperately and
let sum of squares be 3^2+2^2+1^2+5^2+4^2 == 3(last digit) then print valid checksum otherwise invalid| Report Duplicate | Flag | PURGE
Sapient Corporation Developer Program Engineer Arrays - 0of 0 votes
AnswersLogic to print number and number of duplicates of that number in a given array list ?
- Hmmm February 20, 2012 in India for Xen-Client
Ans: It's very easy if you two for loops, anyone can try out & get it in seconds.| Report Duplicate | Flag | PURGE
Citrix System Inc Quality Assurance Engineer Arrays - 0of 0 votes
AnswersDo in place sorting of the given array such that all 0's moves to right and all 1's to left and their relative positioning remains same. Input array a =01001011101
- sumit February 19, 2012 in India
output : 00000111111| Report Duplicate | Flag | PURGE
Persistent Systems Software Engineer / Developer Arrays - 3of 3 votes
Answersone unsorted array is given.Find out the index i and j ,j> i for which a[j] - a[i] is maximum.perform in linear time complexity
- rahul baid February 17, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer Data Structures Arrays