Company: Walmart_12march
Difficulty: medium
Never Ending Problem Description We are provided a sequence defined for any integer N, where the next term is determined by the function: f(N) = 3*N + 1 (if N is odd) f(N) = N/2 (if N is even) The sequence terminates if it reaches 1. Examples: For N = 2, f(2) = 1, so the sequence is 2, 1. For N = 3, f(3) = 10, f(10) = 5, f(5) = 16, f(16) = 8, f(8) = 4, f(4) = 2, f(2) = 1, so the sequence is 3, 10, 5, 16, 8, 4, 2, 1. If the sequence continues forever, we call this an infinite sequence. Given any integer N, can you predict if the sequence terminates or not? Input Format A single integer representing N. Output Format Print "YES" if the sequence terminates otherwise, print "NO". Note: The output is case-sensitive. Constraints 1 <= N <= 10^9 Examples Example 1: Input: 3 Output: NO Explanation: For N=3, we can see that the sequence is 3, 10, 5, 16, 8, 4, 2, 1, and it can be shown that it will never reach 1. Example 2: Input: 4 Output: YES Explanation: For N=4, we can see that the seque