
You are given an integer 'N'.
Return 'odd' if the given number 'N' is odd, else return 'even'.
N=5
Output: odd
The first line contains an integer 'N’, denoting the number.
Output Format:
The output contains a string “odd” or “even”.
Note:-
You don’t need to print anything. Just implement the given function.
9
odd
6
even
1 <= N <= 10^4
Time Limit: 1 sec
Using modulus
Approach:
Find the modulus of ‘N’ with 2. If it comes out 1 then it's “odd” else “even”.
Algorithm:
O(1)
We are simply using if-else statement therefore complexity is O(1).
O(1)
No extra space is used.