Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class questionOne
- {
- static int Best(int[]a,int first,int num)
- {
- if(num==0)
- return first;
- else
- {
- if((a.length-1)>num)
- {
- int y=a[num];
- int x=Best(a,first,num-1);
- if(x>y)
- return x;
- else
- return y;
- }
- else
- {
- int y=a[num-1];
- int x=Best(a,first,num-1);
- if(x>y)
- return x;
- else
- return y;
- }
- }
- }
- public static void main(String[] args)
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement