## winner

BAN USERThe question is not very clear to me .

My Approach acc to what I have understood is -

1. merge the sorted arrays (n in number) and sort them.(merge sort for the n arrays)

2. Find 'n' adjacent number in the resultant array with the condition : last_num- first_num = minimum.

public static int find_first_missing_number(int a[],int p,int q){

int k=(p+q)/2;

if(a[k]-a[k-1]==2)

return a[k]-1;

if(a[k+1]-a[k]==2)

return a[k]+1;

if(a[k]-a[p]>(k-p))

return find_first_missing_number(a,p,k-1);

else

return find_first_missing_number(a,k+1,q);

}

Rep**shanamkyler38**, AT&T Customer service email at ABC TECH SUPPORTHi, I am Shana and I live in Chicago USA .I am working as a Tax preparer in an Adaptabiz ...

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

Dynamic Programming :

- winner March 27, 2015Opt[i] is the number of steps(rules) required between i and 100

Base cases:

Opt[100]=0

Opt[i]=j if ith position has a ladder and j is the other end of ladder, similarly for snake too

recursive rule

Opt[i]=max(1+Opt(k)) { 0< k < 18}

Assuming that we can get min of 1 and max of 17 (6+6+5) in one rule

Find Opt[1]