Company: nvidia_25sep
Difficulty: medium
Binary String Power of Two Regex Problem Description You are given several binary strings. For each one, decide whether the number it represents in base 2 is a power of two ( 1, 2, 4, 8, 16, ... ). In the original assessment, the candidate fills in a regular expression that the locked code applies to each string: the expression must match a string if and only if its base-2 value is a power of two. Here, implement the function solve(s) , which returns true if the value of the binary string s is a power of two and false otherwise. The code in the editor reads the input, calls solve once per string and prints True or False . (inferred -- the source asks only for the regular expression and the judge checks only the printed lines, so any correct method is accepted; a full-string regular-expression match is the intended one.) Input Format Read from standard input. n s[1] s[2] ... s[n] Line 1 contains the integer n , the number of binary strings. Each of the next n lines contains one binary s