A given series 3, 5, 9, 11, 15, 21, 29, ... and so on. You need to identify the pattern and determine whether the input number ( n ) is a part of the given series or not. If yes then return "Yes", otherwise "No".
Input: n = 9 Output: Yes Explanation: 9 is the part of the sequence.
Input: n = 8 Output: No Explanation: 8 is not the part of the sequence
You don't need to read input or print anything. Your task is to complete the function isPart() which takes n as inputs and returns the answer.
Expected Time Complexity: O(sqrt(n))
Expected Auxiliary Space: O(1)
1 ≤ n ≤ 106
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.