×

# What's wrong with my approach for WSITE01.. plz help me

 0 problem link WSITES01 myCode Link My code is giving Correct Answer for all test cases Cheked by me but it is not passing all cases for codechef i tried a lot to found where my code is failing but dont know why plz help me asked 18 May '17, 16:37 293●9 accept rate: 5%

 1 Check this one: 3 - siddharth + sidklmno + pandey Output should be 1 sidd and not 1 siddh I think what you are doing is checking whether all unblocked[i] contains the blocked[i] but along the way you also need to eliminate the strings whose unblocked[i]!=blocked[i] and only check for the remaining ones. Hope this helps :) answered 18 May '17, 17:18 239●5 accept rate: 10% @siddharthp538 ty bro... u nailed it (18 May '17, 17:41) No problem :) (18 May '17, 21:56)
 1 I believe it fails here- Input 4 + hackerrank - hackerrankz + ae - a Output 1 hackerrankz Expected Output -1  I believe that we have to include "ae" but block "a", but "a" is a prefix of "ae", so its not possible to block all bad sites without blocking a good one. So we print -1. answered 18 May '17, 17:26 12.4k●1●4●21 accept rate: 19% @vijju123 i am sure.. u havn't submitted this question till now... output will be -1 when no filter is created... here hackerrankz filter is created so output will 1 (18 May '17, 17:40) No dear, i cross-checked it with correct programs. The output is -1. (18 May '17, 17:44) Here is what Q said- If it is not possible to choose set of filters and satisfy all constraints, output a single line containing an integer -1. And constraints were- A filter is a string that should be a prefix of some blocked site, and it should not be a prefix of any unblocked site You cannot block "a" without blocking "ae" (18 May '17, 17:46) @vijju123 okey bro... i will give another shot to problem (18 May '17, 17:50) Yes, try giving it a shot with this in mind :) (18 May '17, 17:52)
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×1,824
×165
×18

question asked: 18 May '17, 16:37

question was seen: 443 times

last updated: 18 May '17, 21:56