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);
}
Repshanamkyler38, AT&T Customer service email at ABC TECH SUPPORT
Hi, I am Shana and I live in Chicago USA .I am working as a Tax preparer in an Adaptabiz ...
Repharryhamesh, Android Engineer at ADP
I placement officers usually work in colleges and universities. One of My friends taught me about prayers that break curses ...
Replimlocica, News reporter at Smitty's Marketplace
Hello, I am a News reporter. Master's Degree in astrology and News reporter and 10 years of experience working ...
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]