[Community Puzzle] River Crossing

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Wontonimo,validated by @David_Augusto_Villa,@ninnghazad and @anon79121980.
If you have any issues, feel free to ping them.

@Wontonimo I pass all the test cases before submitting, but I cannot figure out why I am failing the “Sorted” test case after submitting. I’ve tested all I can, is there anyway to find out why I am failing that one test?

Never mind, found the bug

Feel free to edit your answer and share what was blocking you. Might help others

Congrats @TheMichaelWatling

The challenge with the “Sorted” test is to make sure to sort the answers. A depth first search would not work but it would pass all the other tests.

Hello, I succeeded in validating all the tests but when I submit the exercise, the test “rescue one” indicates me an error, I do not understand why, do you have an idea?

Did you try finding all possible answers and compare them to select the shortest and then the alphabetically smallest one?

2 Likes

There is a bug in the solutions, in “rescue one” of submit it expect to have the solution with sort reverse.
It’s mean, for example, that if usually you give the priority to “L R L R” respect to “L R R L”, only for that test you must do the opposite.
I avoid the bug setting the condition “if initial have only one letter different from other (ex: L R R R or R L R R , …) use the sort reverse”
In this way you don’t pass the tests but you pass the submit solutions :slight_smile:

I was having issues with Rescue One too but it was a miss on my part, didn’t encounter the problem FAngelo mentioned.

If you’re also having issues with Rescue One when submiting then test this as custom challenge, it’s how I found my mistake.

L R L L
R R R L
L L R L
R L R L
L L L L

1 Like

This puzzle is easy to bruteforce.

With four symbols in the string, there are at most 16 different kinds of startings and 16 different kinds of endings. But some of them are invalid in nature so that actually the combination is 10x10 only.

You can pre-cal all these 100 solutions. You can even hardcode all solutions. I believe there is no error in test cases or validators as described by FAngelo. No ugly tweaking of solution is needed.

3 Likes

Thanks for the hint! Too bad there’s nothing even close to this case within test cases.

Actually really annoying I can’t see the submit test cases…
I pass all the test cases but submitting I do not. Why not show the test cases so you can actually figure out what is wrong instead of having people try to guess?

It’s easier to use recursive dfs than bfs to finish this.
Keeping track of history in bfs is a mess when keeping track of history in a recursive dfs function is simple.
Tags could be updated.

Solved mine with depth first like the duck I am

1 Like