Topic — Add New » Posts Last Poster Freshness
Amazon Interview Question for Software Engineer/Developer about Arrays 2 PsychoCoder 11 hours

Given two arrays, one is 1D array and other is 2D array. U need to find out whether 2D array contains the subset of 1D array. The elements of 1D array not neccessary present in the same row it can be either on the up or down but should be continuous in the 2D array.

Amazon
Amazon Interview Question for Software Engineer/Developer about Arrays 7 PsychoCoder 15 hours

Given an array-based heap on n elements and a real number x, efficiently determine whether the kth smallest element in the heap is greater than or equal to x. Your algorithm should be O(k) in the worst-case, independent of the size of the heap.

Amazon
Amazon Banglore Online Written 5 javanetbeans 16 hours

You are given a function printKDistanceNodes which takes in a root node of a binary tree, a start node and an integer K. Complete the function to print the value of all the nodes (one-per-line) which are a K distance from the given start node in sorted order. Distance can be upwards or downwards.

Amazon Interview Question for Software Engineer/Developer (Fresher) about Arrays 6 PsychoCoder 1 day

Given an array (length n), we need to find the subarray (length k) such that the sum of the first j elements of the subarray equals the sum of the remaining (k-j) elements of the subarray.
For e.g.
Array: 2,2,13,4,7,3,8,12,9,1,5
Output: 4,7,3,8,12,9,1 [4+7+3+8=12+9+1]
Could this be done with a complexity better than O(n^3)

Amazon
Amazon Interview Question for Software Engineer/Developer (Fresher) about Algorithms, Arrays 7 PsychoCoder 1 day

Find least jumps to reach end of the array:
Given an array of Integers,if u are on ith element u can make max arr jumps. If i am at an element with value zero, i cannot move forward.find the least selection to reach end of the array.
ex: 1 3 5 8 9 2 6 7 6 8 9 starting with arr[0] i can only make one jump to 3, from 3 i can jump either 1 step 0r 2 steps 0r 3 steps.
my solution is 1 to 3 to 8, 3 selection and i am done.
Device an algo for this

Amazon
Amazon Interview Question for Software Engineer/Developer about Arrays 3 PsychoCoder 3 days

Given two sorted arrays A1 and A2, of lengths L1 and L2 , L1 < L2 and the last L1 slots in A2 are vacant, get me all the numbers in A2, sorted in the most efficient manner without using extra space. This was a written test question in which I blabbered quick sort will do..

Amazon
Amazon Interview Question for Software Testing (0 - 2 Years) 6 PsychoCoder 3 days

Find a number from the array, which on sutracting with the given number gives minimum value
ex:
array= 2,5,6,8,9
gn number = 1
it should print 2 coz 1 - 2 = -1

Amazon
Amazon Interview Question for Software Engineer/Developer about Algorithms, Arrays 7 kunalgupta1991 1 week

Find out the smallest segment in a document containing all the given words.
Desired Complexity is O nlogK ..n is the total no of words in the document and k is the number of input words

Amazon
Amazon Banglore Online Written 4 vikram.kuruguntla 1 week

In given array of elements like [a1,a2,a3,..an,b1,b2,b3,..bn,c1,c2,c3,...cn] Write a program to merge them like [a1,b1,c1,a2,b2,c2,...an,bn,cn].

PS: Doing without using extra memory would fetch more points

Sample Testcases:

Input #00:

{1,2,3,4,5,6,7,8,9,10,11,12}

Output #00:

{1,5,9,2,6,10,3,7,11,4,8,12}

Explanation:

Here as you can notice, the array is of the form
{a1,a2,a3,a4,b1,b2,b3,b4,c1,c2,c3,c4}

Adobe Interview Question for Software Engineer/Developer (Fresher) about Aptitiude, Arrays, Data Str 5 PINTUGUPTAJUIT 1 week

Predict the Output:

#include<stdio.h>
void main()
{
        char ch1[]="hello", ch2[]="hello";
        if (ch1==ch2)
                printf("Equal\n");
        else
                printf("Unequal\n");
}

I executed this on Linux terminal and got the answer as Unequal. Can anyone please explain how this is happening?

Adobe
Microsoft MBD interview question 4 PINTUGUPTAJUIT 1 week

you have given two large array of unlimited Memory. Each array contain single digit number. You can move only in forward direction in array. You have to created a 3rd array which contain sum of digit of 1st and 2nd array.The condition in array is once you have written the data in 3rd array you cannot modify it and when you add two single digit no from 1st and 2nd array and there sum is greater than or equal to 10. you write 0 in 3rd array and forward the carry upward.
you cannot take te...

Array - all 1s 1 k53 1 week

The elements of an array are 1s and 0s. Change all the elements of this array as 1.
Use only a single statement and do not use any operator other than the assignment operator

Amazon Hyderabad Online Written 2 kartik 1 week

The function maxSumSubArraytakes an array as it's parameter. Complete the function to return the maximum sum of the subarray. The array contains +ve and -ve integers

Sample Testcases:

Input #00:
1 2 -3

Output #00:
3

Explanation:
The different possibilities are 1+2, 2-3, 1, 2-3
The largest sum amongst these is 3

Input #01:
1 2 3

Output #01:
6

Microsoft Interview Question for Software Engineer/Developer about Arrays 4 CoolMan 1 week

Program for intersection of two arrays

Microsoft
Finding no. of elements in an integer array 5 k53 1 week

How to find the number of elements in an integer array ?
Cannot append NULL at the end and check for it bcoz the element 0 will be mistaken as NULL

n=sizeof(arr)/sizeof(arr[0]);
This gives the entire predefined size and not the no. of elements in it

Maximizing valleys in an unsorted array: 1 geek 1 week

A Valley is cell (in an array) which has less value than its immediate neighbours. Given an unsorted array, the task is to rearrange the numbers in such a manner so as to maximize the number of valleys in that array.

Now redefine the Valley to extend the problem. A Valley is now a cell which has value less by a given threshold than its immediate neighbours.

The first part seems easy. Please suggest solutions for the extended problem.

Interview Question for Software Engineer/Developer (Fresher) about Arrays 3 crazyPro 2 weeks

given an unsorted array, find the elements which have the maximum difference in O(n) time