717. Check if a Number is Odd or NotPOTD

Given a non-negative integer n, determine whether it is odd.

Return true if the number is odd, otherwise return false.

A number is odd if it is not divisible by 2 (i.e., n % 2 != 0).

Example 1:

Input: n = 7

Output: true

Explanation: 7 is not divisible by 2. Hence, it is odd.

Example 2:

Input: n = 0

Output: false

Explanation: 0 is divisible by 2. Hence, it is not odd.

Now Your Turn!

Pick the correct output for the given input

Input: n = 10000

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 0 <= n <= 104

Hints

Frequently Occurring Doubts

Interview Follow-up Questions

0
class Solution {
public:
bool isOdd(int n) {
// Your code goes here
}
};
Test Case

Input:

N