Topic — Add New » Posts Last Poster Freshness
Find a pair in a sequence whose sum is another element of the same sequence. 4 gvk 4 months

For example if array is [1, 4, 3, 14, 24, 30 ] then your program shoul be able to find out 1 and 3 as sum of them is present in array.

Asked in Amazon

fragment removal in all files 1 Rahul 4 months

Write a program to remove fragment that occur in all strings,where a fragment
is 3 or more consecutive word.
example :
input::
s1 = "It is raining and I want to drive home.";
s2 = "It is raining and I want to go skiing.";
s3 = "It is hot and I want to go swimming.";
output::
s1 = "It is raining drive home.";
s2 = "It is raining go skiing.";
s3 = "It is hot go swimming.";
removed fragment = "and i want to"
i was told that ...

[closed] copy the list 3 k53 5 months

Given a doubly linked list where
1. one link points to it’s next neighbour
2. Other link points to some random node in the list(could also point to NULL)
Write an algorithm to make a copy of this list

Neither Max nor Min 5 srikantaggarwal 6 months

Suppose a double Dimension array is given of order N x N . And it is filled with distinct elements . Now you have to find the atleast one row which neither contain the maximum or the minimum element among all the elements present . The runtime complexity should be less than O(N^2) .

Construct tree from Ancestor Matrix 13 6 months

You are given a matrix M[n, n] for a tree with n nodes. In the given matrix M, M[i, j] is true iff node j is an ancestor of node i. Construct the tree from the given matrix.

For example, you are given below matrix.

    1  2  3  4
1  0  1  1  0

2  0  0  1  0

3  0  0  0  0

4  0  1  1  0

You need to construct the below tree. In the constructed tree ancestor relationship should be correct. A node can come on left or right of its parent as you cannot determine th...

Amazon Interview Question for Software Engineer/Developer about Puzzle 4 6 months

There are two urns A and B and an equal number of red balls and blue balls.How do u place the balls in the urns such that the probability of picking up the red ball is greater?

Amazon
Amazon question 2 Vivek 6 months

Given two arrays , one is 1D array and other is 2D array . Now 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 ..

Distance between leftmost and rightmost nodes of a binary tree 6 6 months

How to get the distance between the leftmost and rightmost nodes.

             80
           /    \
         9       7
      /   \
     6     10

Distance should be 4 (between 6 and 7) in the example tree.

Design a Air traffic take-off system 1 seeksree 12 months

There are two type of flights - Passenger and Cargo
Each type of flight can be SMALL or LARGE.
Problem is to design a take-off control system such that the following precedence is maintained.
1. Passenger > Cargo.
2. If both flights are same type then LARGE > SMALL
3. If both types and sizes are same then flight with longer GroundDuration(i.e ground stay time) has precedence over other flights.

data structure for jigsaw puzzle 1 dark 1 year

suggest a data structure for jigsaw puzzle

Amazon Online Interview Question 1 1 year

There are K pegs. Each peg can hold discs in decreasing order of radius when looked from bottom to top of the peg. There are N discs who have radius 1 to N; Given the initial configuration of the pegs and the final configuration of the pegs, output the moves required to transform from the initial to final configuration. You are required to do the transformations in minimal number of moves.
A move consists of picking the topmost disc of any one of the pegs and placing it on top of anyoth...

Amazon interview question 6 algoboy 1 year

Generate a sequence from the results of a tournament
In the tournament every player will play with every other player. And the results of these matches are given to u.
U need to generate a sequence such that each player will have the player to whom he has won on his left and the player to whom he has lost to his right

eg. consider p1,p2,p3,p4,p5

if p1 has won against p2 and lost with p5
then p2,p1,p5 is a valid sequence

like wise this rule must be appli...

[closed] Next greater element 11 Sandeep 1 year

This question is recently asked to me by Amazon.

Given an array, print the next greater element for every element. Elements for which no greater element exist, print next greater element as -1.

For the elements of the array [4, 5, 2, 25, 20, 11, 13, 21, 3] greater elements are as follows.

4 --> 5
5 --> 25
2 --> 25
25 --> -1
20 --> 21
11 --> 13
13 --> 21
21 --> -1
3 --> -1

Amazon Interview Question for Software Engineer/Developer (0 - 2 Years) about Algorithms 4 wgpshashank 1 year

Given a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the number of smaller cubes on the surface. Extend this to k-dimension.

Amazon