Odd Game
Submissions: 715   Accuracy:

36.36%

  Difficulty: Easy   Marks: 2

It was a very boring day, so a geek thought to play a game with his friends. To make the day interseting he started playing game. The game was very simple, he intitialised number to all his friends and made them stand in increasing order. eg. 1,2,3,4,5...... 
Now he eleminates the players at odd places and few are left. 2,4...
Again he eleminates the players at odd places and he do this util only one of his friend is left in this game. 4... And the only player left wins.
Now the task geek assigned you was that you have to find which of his friend will win.

Input:
First line contains the number of test cases t. The next t lines contain integer n, the number of players playing this game.

Output:
Display t lines, each containg a single integer, denoting the player which will win.

Constraints:
1<=T<=1000
1<=N<=10^9

Example:
Input:

2
5
12

Output:
4
8

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth
Author: saksham seth


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.