The goal is to convert a number from the skew-binary representation into the decimal one.
In the skew-binary representation, the k-th digit has a value of multiple of 2^k - 1. The only allowed digits are zero and one. The only exception is the least non-zero digit, which can also take the value of two, i.e., for this particular case, the allowed values are zero, one, and two.
The maximal value that is to be considered is (in its decimal form) 2^31 - 1 = 2 147 483 647.
If the input number does not respect the rules above, specifically if there are non-zero digits after the 2 digit, the output is Error (without newline).
110200 = 1 * (2^6 - 1) + 1 * (2^5 - 1) + 0 * (2^4 - 1) + 2 * (2^3 - 1) + 0 * (2^2 - 1) + 0 * (2^1 - 1) = 63 + 31 + 0 + 14 + 0 + 0 = 108
20 freelancers are bidding on average ₹1015 for this job
Hi, I have more then 5 years of experience in JAVA,Web technologies like Spring , Hibernate and Desktop application like JAVAFX. I will complete your project within 1 hour. Thanks, Bhavin Jethava
I have good knowledge of Java and data structures and I can get your work done [login to view URL] if you have any query Relevant Skills and Experience Java Proposed Milestones ₹700 INR - After work completion