sachinism
- 22
0of 0 votes
AnswersGiven a 2-D MxN matrix having each value as difficulty for the block. A frog is starting from a point Matrix[0][0] and will have to reach Matrix[M-1][N-1]. It can jump any step in one go [ 1, 2, ..... M-1] horizontally OR [ 1,2,3,.... N-1] vertically
- sachinism on November 12, 2012 in India Edit | Report Duplicate | Flag
Each difficulty value is positive. Write code to give path trace for frog.
Two structure to use -
struct node
{
int x;
int y;
struct node *next;
};
struct path
{
int difficulty;
struct node *pathlink;
}
Ex matrix - 4X4 matrix
7 9 2 11
13 23 1 3
14 11 20 6
22 44 3 15
Minimum difficulty = 7 (a[0][0])+ 2(a[0][2]) +3(a[3][2])+15(a[3][3]) = 27
Path trace will have = 7->2->3->15
Amazon Software Engineer / Developer - 23
0of 0 votes
Answersfind a^b using optimal algorithm.... [ no use of inbuilt functions?
- sachinism on June 16, 2012 in India Edit | Report Duplicate | Flag
Goldman Sachs Software Engineer / Developer Algorithm - 24
0of 0 votes
AnswersHow to find consecutive elements such that they have maximum sum ??
- sachinism on June 16, 2012 in India Edit | Report Duplicate | Flag
-2 4 2 3 -12 5 9 -3 4
=> Max SUM = 15
index i =5 to 8
Goldman Sachs Software Engineer / Developer Algorithm - 18
0of 0 votes
AnswersHow to find 4 largest elements of an given array of length n. Best possible option ??
- sachinism on June 16, 2012 in India Edit | Report Duplicate | Flag
Goldman Sachs Software Engineer / Developer Algorithm
Can you please present it with example... becoming ambiguous in above case....
- sachinism on June 17, 2012 Edit | Flag View Reply