X

DAYS

:

HOUR

:

MINS

:

SEC

Copied to Clipboard
Reverse Coding
Easy Accuracy: 67.64% Submissions: 3609 Points: 2

Sherlock Being tired with the usual coding rounds started growing his interest towards reverse coding when he won the event in his college symposium. He wondered if his friend has the brain to quickly identify the pattern and verify if his inputs are correct or not. From the example portion given below, where you will be given a number(n) and its output m, Using this find the pattern. Your task is that from the pattern you identified above, You have to tell if for the given n whether the given m is the correct answer or not.

Example to identify the pattern :
Input                            Output
10                                 55
20                                 210
5                                   15
0                                    0
1                                    1
2                                    3

Example 1:

Input:
n = 10, m = 55
Output:
1
Explanation:
It follows the given pattern.

Example 2:

Input:
n = 4, m = 11
Output:
0
Explanation:
It doesn't follow the given pattern.

You don't need to read input or print anything. Your task is to complete the function revCoding() which takes 2 Integers n, and m as input and returns 1 if it follows the given pattern else returns 0.

Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

Constraints:
0 <= n <= 104
0 <= m <= 108