MYSTERY

Jon Snow visits Dragonstone to meet Daenerys Targaryen. He asks for aid in defeating the White Walkers and Army of Dead. But Daenerys refuses to believe that white walkers are real. She puts a condition before Jon that if he solves the challenge given by her then she will send her army to fight White Walkers. She gives certain inputs and outputs, Jon needs to find the logic and predict the output for the corresponding inputs. Jon Snow is struggling with the challenge as he knows nothing!! Help Jon to find the logic and win this challenge.

Example:

Input:  n = 5
Output: 1

Approach

C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n = 5;
    long long res;
    long long y = -n;
    res = n & y;
    cout << res << "\n";

    return 0;
}


No comments:

Post a Comment