- Prepare
- Data Structures
- Trie
- No Prefix Set
- Discussions
No Prefix Set
No Prefix Set
+ 9 comments Just remember that there will be two conditions to check. (Look out for abc and abcde in below test cases):
The prefix string comes before the longer string.
- 7
- aab
- defgab
- abc
- abcde
- cedaaa
- bbbbbbbbbb
- jabjjjad
Prefix string will come after the longer string.
- 7
- aab
- defgab
- abcde
- abc
- cedaaa
- bbbbbbbbbb
- jabjjjad
Make sure that you get correct output for both the cases, and you may trust that other things will fall in place.
+ 1 comment @bokamvinaykumar Please upload the test cases.
+ 1 comment These instructions are not clear. They say "Output GOOD SET if the set is valid. Else, output BAD SET followed by the first string for which the condition fails."
Is the first string for which the condition fails the string that is a prefix of another string, the string that is prefixed by another string, or the first string that appears ordinally in the input list?
+ 3 comments I believe that the test cases here are not all correct : let me give you an example I got this test case
100 hgiiccfchbeadgebc biiga edchgb ccfdbeajaeid ijgbeecjbj bcfbbacfbfcfbhcbfjafibfhffac ebechbfhfcijcjbcehbgbdgbh ijbfifdbfifaidje acgffegiihcddcdfjhhgadfjb ggbdfdhaffhghbdh dcjaichjejgheiaie d jeedfch ahabicdffbedcbdeceed fehgdfhdiffhegafaaaiijceijdgbb beieebbjdgdhfjhj ehg fdhiibhcbecddgijdb jgcgafgjjbg c fiedahb bhfhjgcdbjdcjjhaebejaecdheh gbfbbhdaecdjaebadcggbhbchfjg jdjejjg dbeedfdjaghbhgdhcedcj decjacchhaciafafdgha a hcfibighgfggefghjh ccgcgjgaghj bfhjgehecgjchcgj bjbhcjcbbhf daheaggjgfdcjehidfaedjfccdafg efejicdecgfieef ciidfbibegfca jfhcdhbagchjdadcfahdii i abjfjgaghbc bddeejeeedjdcfcjcieceieaei cijdgbddbceheaeececeeiebafgi haejgebjfcfgjfifhihdbddbacefd bhhjbhchdiffb jbbdhcbgdefifhafhf ajhdeahcjjfie idjajdjaebfhhaacecb bhiehhcggjai bjjfjhiice aif gbbfjedbhhhjfegeeieig fefdhdaiadefifjhedaieaefc hgaejbhdebaacbgbgfbbcad heghcb eggadagajjgjgaihjdigihfhfbijbh jadeehcciedcbjhdeca ghgbhhjjgghgie ibhihfaeeihdffjgddcj hiedaegjcdai bjcdcafgfjdejgiafdhfed fgdgjaihdjaeefejbbijdbfabeie aeefgiehgjbfgidcedjhfdaaeigj bhbiaeihhdafgaciecb igicjdajjdegbceibgebedghihihh baeeeehcbffd ajfbfhhecgaghgfdadbfbb ahgaccehbgajcdfjihicihhc bbjhih a cdfcdejacaicgibghgddd afeffehfcfiefhcagg ajhebffeh e hhahehjfgcj ageaccdcbbcfidjfc gfcjahbbhcbggadcaebae gi edheggceegiedghhdfgabgcd hejdjjbfacggdccgahiai ffgeiadgjfgecdbaebagij dgaiahge hdbaifh gbhccajcdebcig ejdcbbeiiebjcagfhjfdahbif g ededbjaaigdhb ahhhcibdjhidbgefggdjebfcf bdigjaehfchebiedajcjdh fjehjgbdbaiifi fbgigbdcbcgffdicfcidfdafghajc ccajeeijhhb gaaagfacgiddfahejhbgdfcfbfeedh gdajaigfbjcdegeidgaccjfi fghechfchjbaebcghfcfbdicgaic cfhigaciaehacdjhfcgajgbhhgj edhjdbdjccbfihiaddij cbbhagjbcadegicgifgghai hgdcdhieji fbifgbhdhagch cbgcdjea dggjafcajhbbbaja bejihed eeahhcggaaidifdigcfjbficcfhjj
the output is supposed to be (as suggested by the test case):
BAD SET d
How come?????
is there any word which is a prefix of "d"?
if you think so, give me which one???
+ 1 comment how to optimize the code for this as my code is not running for last 5 cases . help me !!!
Sort 145 Discussions, By:
Please Login in order to post a comment