The definition of "edge case" normally refers to situations that happen very rarely and cause your code to fail. In this case, since you're failing almost every test the same way, the problem is, by definition, not an "edge case."

Terminology aside, what do you think is causing these exceptions? What in your code is making them happen?

In the case of this problem, I would consider the edge cases to be determined based on the size of the array. One edge case would be when you pass in an empty array (which is one of the tests) and another would be when you pass in a very large array.

It's not really important what you call it, though, as long as you know where to focus your attention. It looks like you've got everything but the last element sorted out!

That looks good to me. If you want to do it without creating a separate array, you could store nums[0] in a variable before you do the looping, then stick it at the end after the looping is done. But since the challenge says you can do it either way, this will work fine!

Featured Post

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.