Baseline Bit Manipulation · Learn Bit Manipulation O(1) · O(1)
A stadium turnstile reports crowd counts as integers, and the gate controller only needs to know whether the count is odd or even before opening lanes. The fastest probe reads the count's least significant wire: voltage present means an odd count, absent means even. No division, no modulo — one wire answers instantly.
Input: A positive integer N.
Output: The string "odd" when the least significant bit of N is set, "even" otherwise.
1 <= N <= 10^9Input: {"n":1}
Output: "odd"
The least significant wire of 1 carries voltage.
Input: {"n":42}
Output: "even"
42 ends in a 0 bit, so the turnstile reports an even count.