Check for Binary
Submissions: 11071   Accuracy:

42.72%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Given a non-empty sequence of characters, return true if sequence is Binary, else return false

Input:

The task is to complete the method that takes a string as argument. We should not read any input from stdin/console. There are multiple test cases. For each test case, this method will be called individually.

Output:
Your function should return true str is binary, else false

Constraints:
1 <=T<= 50
1 <=Length of str<= 10000

Example:

Input:
2
101
75

Output:
1
0

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

Contributor: Amit Khandelwal
Author: kartik


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.