Binary numbers
Practice
3.4 (37 votes)
1 D array
Arrays
Data structures
Medium
String manipulation
Problem
78% Success 7231 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
You are given a set of binary elements. You have to eliminate the binary numbers that contain \(11\) as a substring. The resultant sequence will be 1, 10, 100, 101, 1000, and so on.
You are required to generate the code to determine the \(K^{th}\) value of the new sequence.
Input format
- First line: \(T\) denoting the number of test cases
- Next \(T\) lines: A single integer \(K\)
Output format
Print \(T\) lines representing the code to display the \(K^{th}\) value.
Constraints
\(1 \le T \le 10^{5}\)
\(1 \le K \le 10^{8}\)
Explanation
Test case 1: The sequence is 1,10,100 and so on . So the 3rd element of sequence is 100
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
40 votes
Tags:
1-D ArrayArraysData StructuresEasyOne-dimensionalOpenapproved
Points:30
64 votes
Tags:
ArraysData StructuresMediumOne-dimensionalStacks
Points:30
39 votes
Tags:
ArraysData StructuresData manipulation1-D
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output