I solved the question using trie and set, however got WA on two cases in subtask 2. Here is the solution. If someone could point out the error or provide certain test case(s), it would be great help. Thanks in advance.
4 + google + googld - goog - googles
i am getting WA in two test case …plz help me …
I misunderstood the question. Thanks!
Why isnt the answer for the above test case “googles”?
If you write just googles then goog will be missing.
@devilhector can you explain me if you understood the above test case.
Even I have those 2 test cases wrong.
You need to block all minuses. Answer is -1 because there’s no way to block
goog without blocking
3 + google + googld - googles
output should be
but you’re outputing
I am getting WA.Can anyone post what is wrong in my solution.Here is my solution.If someone could point out the error or provide certain test case(s), it would be great help. Thanks in advance.
1 karma users can ask questions here-
can you please check mine … its passing all the above test cases … please let me know where it went wrong.
i made two seperate arrays for blocked and unblocked and then solved this one…
(sorry i cant post a question yet… so asking here)
@mayank_code you need to answer prefixes that block all ‘-’ but are not prefixes of any ‘+’ or unblocked sites.
My code passes all cases except 2. Can someone please explain what i have done wrong. I used a very naive approach of sorting the strings and applying binary search to find the closest +ve string …
add spaces in the testcase then it gives right answer.
Noted, thanks for indicating that. Will come up with fresh test case soon
Hi I have tried a lot … but 2 TCs area failing…
I checked all the below TCs all are passing . Could somebody please help me in this…
//If all positive strings Output should be : 0
4 + youtube + abcd + abcdchef + zzyy Output 0
//// all negative
5 - abcdchef - youtube - youtubeisbest - google - googled Output : 3 a g y /// show strings in sorted order 6 + google + googld - googles - googlea - googlds - googldr OUTPUT : 4 googldr googlds googlea googles //////Any mathched -ve string shorter then positive 4 + google + googld - goog - googles OUTPUT : -1 ////Any mathched +ve string Longer then negative 3 - goog - googles + google OUTPUT : -1
2 - abc + abc OUTPUT -1