11. Gray to Binary equivalent
My Approach
Time and Auxiliary Space Complexity
Code (C++)
class Solution {
public:
int grayToBinary(int n)
{
int ans = 0;
while(n > 0)
{
ans = ans ^ n;
n = n >> 1;
}
return ans;
}
};Contribution and Support
Last updated