Q-19 Binary String With Substrings Representing 1 To N - LeetCode

PHOTO EMBED

Wed Jan 25 2023 20:53:14 GMT+0000 (Coordinated Universal Time)

Saved by @Ayush_dabas07

class Solution {
    public boolean queryString(String s, int n) {
        for(int i = 1 ; i <= n ; i++){
            String temp = Integer.toBinaryString(i);

            if(s.contains(temp) == false) 
            return false;
        }
        return true;
    }
}
content_copyCOPY

https://leetcode.com/problems/binary-string-with-substrings-representing-1-to-n/