I am completely stumped. I took a break for a few hours and I can\'t seem to figure this one out. It\'s upsetting!
I know that I need to check the current element in
You need two loops:
For where you're starting
A nested loop, to be one index in front of where you're currently at, unless you're at the end.
Is there a number you don't EVERY expect to be in your array? If so, use that value (-1 for example) as a sentinel value to overwrite your occurrences as they are counted. Then as you go through the array again for the next number to check for occurrences, you skip it if it has your sentinel value.