Have the function ArrayChallenge(arr) take the array of integers stored in arr, where each integer represents the maximum number of steps that can be made from that position, and determine the least amount of jumps that can be made to reach the end of the array. For example: if arr is [1, 5, 4, 6, 9, 3, 0, 0, 1, 3] then your program should output the number 3 because you can reach the end of the array from the beginning via the following steps: 1 -> 5 -> 9 -> END or 1 -> 5 -> 6 -> END. Both of these combinations produce a series of 3 steps. And as you can see, you don't always have to take the maximum number of jumps at a specific position, you can take less jumps even though the number is higher.
If it is not possible to reach the end of the array, return -1.
Examples
Input: new int[] {3, 4, 2, 1, 1, 100}
Output: 2
Input: new int[] {1, 3, 6, 8, 2, 7, 1, 2, 1, 2, 6, 1, 2, 1, 2}
Output: 4
Your table: maintable_FK60F
MySQL version: 5.5.56-log
In this MySQL challenge, your query should return the rows from your table where LastName = Smith or FirstName = Robert and the rows should be sorted by Age in ascending order. Your output should look like the following table.
ID | FirstName | LastName | Age |
1 | Daniel | Smith | 25 |
2 | Mike | Smith | 22 |
3 | Jenny | Richards | 28 |
4 | Robert | Black | 22 |
5 | Noah | Fritz | 30 |
6 | Ashley | Johnson | 25 |
Have the function StringChallenge(str,num) take the str parameter and perform a Caesar Cipher shift on it using the num parameter as the shifting number. A Caesar Cipher works by shifting each letter in the string N places in the alphabet (in this case N will be num). Punctuation, spaces, and capitalization should remain intact. For example if the string is "Caesar Cipher" and num is 2 the output should be "Ecguct Ekrjgt".
Examples
Input: "Hello" & num = 4
Output: Lipps
Input: "abc" & num = 0
Output: abc