Skip to content
Onsite

Odd Position Elements

EasyP3Coding

Return the elements of nums that sit at odd indices (1, 3, 5, ...), in their original order. Indices start at 0.

Example 1

Input
nums = [10,20,30,40,50]
Output
[20,40]

Example 2

Input
nums = [1]
Output
[]

Example 3

Input
nums = []
Output
[]

Constraints

  • 0 <= nums.length <= 10^5
  • -10^9 <= nums[i] <= 10^9

Hints

Run checks the 3 visible tests, Submit all 10.