Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int jumpIt(const int board[], int startIndex, int endIndex)
- {
- int cost = board[startIndex];
- if(startIndex >= endIndex && endIndex%2 == 0)
- {
- return board[endIndex];
- }
- else if(startIndex >= endIndex && endIndex%2 != 0)
- {
- return cost;
- }
- else if(board[startIndex+1] < board[startIndex + 2])
- {
- cost = (board[startIndex] + jumpIt(board, startIndex + 1, endIndex));
- return cost;
- }
- else if(board[startIndex+2] < board[startIndex +1])
- {
- cost = (board[startIndex] + jumpIt(board, startIndex + 2, endIndex));
- return cost;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement