ZhouZhou
BAN USERminSteptoEnd(int[] arrays){
if(arrays==null || arrays.length==0){return 0;}
if(arrays.length=1) return 1;
return minSteptoEndIn(0, arrays.length-1,arrays,0);
}
int minStepToEndIn(int start, int end, int[] arrays, int steps){
if(start>=end){
return steps;}
}
int min=Integer.MIN_VALUE;
for(int i =1;i<arrays[start];i++){
int curMin=minStepToEndIn(start+i,end,array,step+1);
if(min<curMin){
min=curMin;
}
}
return curMin
void insertValue(Node head, Node tail, int value){
if(head == null){
Node t = new Node(value);
head = t;
t.next = head;
tail =t;
}
if(value<head.value){
Node t = new Node(value);
t.next = head;
head =t;
tail.next =t;
}
Node pre = head;
while(pre.next!=tail){
if(pre.value>value){
Node t = new Node(value);
t.next = pre.next;
pre.next = t;
break;
}else{
pre= pre.next;
}
}
if(pre == tail){
Node t = new Node(value);
t.next = pre.next;
pre.next = t;
tail = t;
}
}
minSteptoEnd(int[] arrays){
- ZhouZhou May 25, 2014if(arrays==null || arrays.length==0){return 0;}
if(arrays.length=1) return 1;
return minSteptoEndIn(0, arrays.length-1,arrays,0);
}
int minStepToEndIn(int start, int end, int[] arrays, int steps){
if(start>=end){
return steps;}
}
int min=Integer.MIN_VALUE;
for(int i =1;i<arrays[start];i++){
int curMin=minStepToEndIn(start+i,end,array,step+1);
if(min<curMin){
min=curMin;
}
}
return curMin;