X494: Review - Same Ends

[Based on an exercise at https://codeworkout.cs.vt.edu/]

Given an array of int values, return true if the group of n numbers at the start of the array is the same as the group of n numbers at the end of the array. For example, with {5, 6, 45, 99, 13, 5, 6}, the ends are the same for
n == 0 and n == 2, and false for n == 1 and n == 3.
You may assume that n is in the range 0..nums.length, inclusive.

Examples:

sameEnds({5, 6, 45, 99, 13, 5, 6}, 1) -> false

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.