• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
April 12, 2024 |410 Views
PROBLEM OF THE DAY : 11/04/2024 | Gray to Binary equivalent
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Nitin Kaplas. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Number Theory but also build up problem-solving skills.

In this problem, we are given, an integer number n, which is a decimal representation of Gray Code. Find the binary equivalent of the Gray Code & return the decimal representation of the binary equivalent.

Note: Please visit here to learn How Gray Code is generated.

Example :

Input: 
n = 4
Output: 
7
Explanation:
Given 4, its gray code =  110. Binary equivalent of the gray code 110 is 100. Return 7 representing gray code 100.

Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/gray-to-binary-equivalent-1587115620/1