We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
So... the only way to solve this task is to look at the answers...
The problem is described leaving several ways to solve it. And then test cases are riddled with assumptions on how the programmer will solve this problem.
Also, all examples show the code failing at full string and not a prefix.
So in my code I only asked a question - Does this string have a prefix in a given List?
It does say to output "first string that it fails at". I can check the strings in whatever order I want (or think in what order it would usually run faster). But whatever, examples did not sort the List too.
So I solve the problem and then hidden tests say my answers are wrong because half of them expect me to return a prefix and not a full string...
It assumed that I would check if the string is a prefix or has a prefix, not just one of those questions even if asking only one of the questions still solves the problem and is faster.
And it also assumes, that I will check for prefixes only in the entries preceding the string being checked and not a whole List at once.
Also, why in all tasks they say array and then give a list?
No Prefix Set
You are viewing a single comment's thread. Return to all comments →
So... the only way to solve this task is to look at the answers... The problem is described leaving several ways to solve it. And then test cases are riddled with assumptions on how the programmer will solve this problem.
Also, all examples show the code failing at full string and not a prefix. So in my code I only asked a question - Does this string have a prefix in a given List?
It does say to output "first string that it fails at". I can check the strings in whatever order I want (or think in what order it would usually run faster). But whatever, examples did not sort the List too.
So I solve the problem and then hidden tests say my answers are wrong because half of them expect me to return a prefix and not a full string... It assumed that I would check if the string is a prefix or has a prefix, not just one of those questions even if asking only one of the questions still solves the problem and is faster.
And it also assumes, that I will check for prefixes only in the entries preceding the string being checked and not a whole List at once.
Also, why in all tasks they say array and then give a list?