Saksham_Sahgal's blog

By Saksham_Sahgal, history, 2 years ago, In English

Given a Binary String and a number x , tell whether there exists a continuous substring with ( no of zeros — no of ones ) = x output its index l to r (0 based indexing) eg —

string = 1 1 0 0 1 0 0 1 0 0 1 0 1 1

x = 3

output — (you can output any possible l to r)

YES , from index 2 to index 6

OR

YES , from index 2 to index 8

  • Vote: I like it
  • +5
  • Vote: I do not like it

| Write comment?