Adityaxv's blog

By Adityaxv, 6 weeks ago, In English

Problem

My Solution

1964/2028 test cases have been accepted. Below is one of the test cases in which my code gives a wrong output:

Testcase
  • Vote: I like it
  • -1
  • Vote: I do not like it

»
6 weeks ago, # |
  Vote: I like it -8 Vote: I do not like it

I think it's easier to solve using a Trie

»
6 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

You missed the non-overlapping constraint.