Check-if-a-string-contains-all-binary-codes-of-size-k

https://leetcode.com/problems/check-if-a-string-contains-all-binary-codes-of-size-k/submissions/

Can anyone explain the error in above code??

  • S : binary String
  • K : Integer

Explanation : With given Integer K you need to check if all possible binary strings that can be formed with size K are substrings of the Given string S.

if (All binary strings of size K are substrings of S) 
output : True
else
output : false

I have generated the substrings from given string,and checking whether all the 2powerk strings are generated or not.