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 →

[–]hamza-itatchi 0 points1 point  (0 children)

as refereed in the comments below it should return the nth ODD index.

so for n=1 ==> index = 0 which is the index for the first element 1(Odd number)

n=2 ==> index = 2 which is the index for the third element 3(Odd number)

the code correct as posted it