# 微软onsite过经

Azure Storage组

Givent an array containing numbers `1 to n` where `array[i] = i+1` find the minimum number of jumps required from `arr[0]` to `arr[n-1]` .

Constraints:-

• From current position `i` , we can jump to positions `i+1` , `i+2` , `i+3` and `i+4`
• There are optional boosters given in the form of an object like - `{1: 15, 5: 10}` which means, if we reached at index `1` we can directly jump to index `15` similarly, if we reached at index `5` , we can directly jump to index `10` .

Find the minimum number of jumps required?

``````Ex. arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
boosters  = {3: 8, 5:10}

The minimum number of jumps is : 4 (1 -> 5 -> 10 -> 14 -> 15)
``````

Questions -

1. Given an array, find the maximum length subarray which sums up to 0. (Sometimes they ask for minimum length too.)
2. Implement the following funtion -
``````public String findTime (int time, boolean isAm, int offset) {

// time is an integer between 0 - 12
// offset can be -ve or +ve
// Add the offset to the input time and return the new time along with the AM/PM indication in 12 hour format."
// Example: return "5 PM"
}
``````

Questions -

1. Given an array, find the maximum length subarray which sums up to 0. (Sometimes they ask for minimum length too.)
2. Implement the following funtion -
``````public String findTime (int time, boolean isAm, int offset) {

// time is an integer between 0 - 12
// offset can be -ve or +ve
// Add the offset to the input time and return the new time along with the AM/PM indication in 12 hour format."
// Example: return "5 PM"
}
``````