Info.Dubey
BAN USER- 0of 0 votes
AnswersA flipping rule is given as a follows: Consider a series of positive integer. Take three numbers in the series next to each other. On applying the flipping rule to these numbers, the right most number will go to the left most number position and the other two numbers will move one position to the right at the same time. The rule can be applied to any three numbers present next to each in the series and can be applied as many times as needed.
- Info.Dubey in India
Given n as the number of element in the original series, elements of the original series and a target series of a numbers, figures out if the target series can be created by flipping numbers of the original number and output the word “POSSIBLE” followed by the number of times the flipping rule has to be applied. In case, the target series cannot be formed, output the word “IMPOSSIBLE”.
Example :
For a series with 4 elements in it, 1 3 4 2 a new series = 4 3 2 1 can be formed by applying flipping rule as follows, From the table below we can say the output is POSSIBLE 3.
Steps
Series
The three Numbers Flipped
Resultant Series
1
1 3 4 2
1 3 4
4 1 3 2
2
4 1 3 2
1 3 2
4 2 1 3
3
4 2 1 3
2 1 3
4 3 2 1
Example input
Example OutPut
4 1 3 4 2 4 3 2 1
POSSIBLE 3
6 1 2 3 4 5 6 6 5 4 3 2 1
IMPOSSIBLE| Report Duplicate | Flag | PURGE
Infosys Software Developer C++ - 0of 0 votes
AnswersBinary search inorder traversal asked by Amazon
- Info.Dubey in India
struct Node
{
int data;
Node *right.*left,*random
}
Tree should be in-order traversal and random node should keep the in-order transversal path.| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Structures - 0of 0 votes
AnswersAmazon interviewer has told to made a program which print number increment or decrement fashion depend on the user input.
- Info.Dubey in India
suppose if user enter "ID" where "I" stands for increment number and "D" stands for decremental number and produced output should be 231. they have given three condition first condition Number should be belongs from 1 to 9.
second condition number should not be duplicate
third number should be least number.
example:
User input "ID"
Number should be 231
if User Input "IDDI"
then output should be 45312
if user input "IID" then output should be 2341| Report Duplicate | Flag | PURGE
Amazon Software Developer