I need help in this question .

Правка en1, от Saksham_Sahgal, 2022-04-13 22:08:14

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

Теги greedy, sliding window, prefix sum

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Saksham_Sahgal 2022-04-13 22:08:14 422 Initial revision (published)