Kriya'11 Code Debugging

26/02/2011 22:20

Here are few problems in

Prelims:

1. Merging two sorted array in the first array in O(n)
2. Maximum and Minimum Subsequence Problem
3. Divisibility by 3 without using Mutiplicative Operators
4. Code for fing the Endianess of the System

Finals:

1. There are two arrays of the form [a1,a2,a3,...an,b1,b2,b3,...bn,...c1,c2,c3,...cn]

You need to make it up as [a1,b1,c2,a2,b2,c2,....an,bn,cn] with Time Complexity = O(n) and Space Complexity=O(1)

2. Chess Game with a little change! Knight has all its natve properties except the thing that it is not able to move to a position by L move if it has got any one on its way (Normally it can go... right?). Here your Question. Then can you design an algorithm to give me the least no. of moves and the path through which I can get my knight to the desired position on the board with the constraints being followed as above!

Sample

Input:

Current Position e3

Destination Position d5

How many other Pieces on board: 1

Position of the 1st Piece: e4

Output:

Minimum no. of Moves : 3

Path: e3-->c4-->b6-->d5

3. There is Grid of Characters. You are given with a word find. You can start from any block in it and need to trace the occurances of find in it by moving from that block either up, down, right, left or diagonally once but not remaining in the same block.

Sample Input:

Grid Size: 3

Grid:

a b c

a b c

a b c

Find: abc

No. of ways: 17