1 year ago

#151454

test-img

Komal Pal

We would be given with stream of data i.e a,b,c,.. and we need to remove first occurring consecutive duplicate substring

Remove repeating n tokens iteration. 1, 2, 3, 4,

iteration 1: repeating 1 seq example a,a,a,a,b,a,a,a,a,a, ==> a,b,a ^,^, ^

iteration 2: repeating 2 seq example a,a,a,a,b,a,b,a,b,a, ==> a,b,a ^, ^,^

iteration 3: repeating 3 seq example a,a,a,a,b,c,a,b,c,a,b,c,e ==> a,b,c,a,b,c,e ^, ^,^,^,^,^,^ . . . iteration 4:(combination of iteration 2 and iteration 3)

  a,a,a,a,b,c,a,b,c,a,b,c,b,c,e ==> a,b,c,a,b,c,e
        ^,      ^,^,^,    ^,^,^

Here we would be given with stream of tokens(here token refers to msg id which has further information about time stamp and some other information). So as we are having time stamp dedicated to each message id so we require only latest timestamp and need to remove duplicate substring which had occurred previously. Thus only recent duplicate substring would be stored and previous consecutive substring would be removed. If after removal of duplicate substring if we have stored any substring then a new window will start for upcoming stream which will check for duplicates in next window of stream of character.

stream

duplicates

window

substring

sliding

0 Answers

Your Answer

Accepted video resources