Question
Python solution to the following algorithm question: 'Query String': Give a binary string str and an integer n to check if the substring of the
Python solution to the following algorithm question: 'Query String':
Give a binary string str and an integer n to check if the substring of the string contains all binary representations of non-negative integers less than or equal to the given integer.
String length does not exceed 100,000 n does not exceed 100,000 Binary starts at 0 and does not require leading zeros
Description
Give a binary string str and an integer n to check if the substring of the string contains all binary representations of non-negative integers less than or equal to the given integer.
String length does not exceed 100,000 n does not exceed 100,000 Binary starts at 0 and does not require leading zeros
Have you met this question in a real interview? Yes
Problem Correction
Example
Given str="0110",n=3, return yes.
The substring of str contains "0", "1", "10", "11".
Given str="0110",n=4, return no.
The substring of str does not contain "100"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started