Is this solution correct?

https://www.codecademy.com/paths/computer-science/tracks/cspath-discrete-math/modules/permutations-and-combinations/articles/permutations-and-combinations-problem-set

A robot traveling from point (0, 0) to point (6, 8) must take eight steps to the right, and six steps down. This can be represented as a string like so:

RRRRRRRRDDDDDD

Where R represents a step to the right, and D represents a step down. The number of ways to traverse the entire grid in the described manner is the number of permutations of the above 14-character string.

There are initially 14! permutations of the string. However, no distinction can be made between any of eight R’s and any of the six D’s, so the number of permutations has to be scaled down by the number of permutations of R’s and the number of permutations of D’s.

The answer is:

\frac{14!}{6!8!} = 3,003 
6!8!
14!

=3,003

There are 3,003 ways to traverse the grid.

If the grid is 8 X 6, wouldn’t that be seven steps to the right, and five steps down?

12! / 5! * 7!
=> 12 * 11 * 10 * 9 * 8 * 7! / 5! * 7!
=> 12 * 11 * 10 * 9 * 8 / 5!
=> 11 * 9 * 8
= 792

I can concur, the instructions aren’t consistent. If the grid is 8 x 6 but the starting square is (0, 0) there can’t be a target (8, 6) in it.

I think the question is, is it an issue with the grid’s size, the bot’s starting square, or our target? If the size is off, I’d answer with 14! \ (8! * 6!), but if either the target or starting point is off, I’d say you’re right with the 12! \ (7! * 5!).

Which detail has the mistake though I can’t say :man_shrugging:


Perhaps some statistics?

error  |  answer
-------+--------
board  |   3003
start  |    792
target |    792

Looks like we got two to one odds in favor of your answer :wink:

1 Like