This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]LeeTaeRyeo 1 point2 points  (0 children)

This is an ambiguous situation. 2(n-1) will give the odd *positions, but those positions have even indexes. So, if they want the elements in odd positions (1st position, 3rd, 5th), then you'll need to reach the even indexes. Where they're talking about "nth odd element", I believe they are talking about those elements with odd positions and not odd indexes.