You are given the binary representation of a number. You must consider the highest number of set bits in the binary representation to complete your task. For example, is represented as in binary and it contains four set bits (1-bits). You are also given a number and your task is to determine the number that is less than or equal to and contains the maximum number of set bits in its binary representation.
In other words, print a number that is less than or equal to such that the number of set bits in the binary representation of must be maximum
Input format
First line: An integer denoting the number of test cases
For each test case:
First line: An integer
Output format
For each test case, print the answer on a new line denoting a number that is less than or equal to such that the number of set bits in the binary representation of must be maximum.
Constraints
SAMPLE INPUT
1
345
SAMPLE OUTPUT
255
Explanation
The number 255 (< 345) has most number of set bits.
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded if any testcase passes.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8
Answers
Answered by
0
Answer:
very nice qus.......
Explanation:
good
Answered by
0
Answer:
just free points
$$$$$$$$$$$☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️☺️
Similar questions