[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 @davilla,@ninnghazad and @Schwase.
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

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.

2 Likes