Ankit
BAN USER- 0of 0 votes
AnswersIn a hall there are many peoples, where some people know each other, one one person who dont know anyone but all other people know him, So we have to find that person.
- Ankit in India
You have to use this method
boolean knows(personA, personB){}
It will return true if person knows each other other wise false.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 0 votes
AnswersPrefix Expression to Postfix Expression.
- Ankit in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - -1of 1 vote
AnswersGiven two positions in a 2-D matrix, say (x1, y1) and (x2, y2) where x2>=x1 and y2>=y1. Find the total number of distinct paths between (x1, y1) and (x2, y2). You can only move in right direction i.e. positive x direction (+1, 0) or in up direction i.e. positive y direction (0, +1) from any given position.
- Ankit in India
Example: If the given coordinates are (3,3) and (5,5), the number of distinct paths are 6 : one going through 3,5 ; one going through 5,3 and four going through 4,4.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 1of 1 vote
AnswersGiven an array containing sequence of bits (0 or 1), you have to sort this array in the ascending order i.e. all 0' in first part of array followed by all 1's. The constraints is that you can swap only the adjacent elements in the array. Find the minimum number of swaps required to sort the given input array.
- Ankit in India
Example: Given the array (0,0,1,0,1,0,1,1) the minimum number of swaps is 3.
Note: You just need to complete the function given below for this task. The function is given a binary string as input and returns the required answer.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays Data Structures Sorting