Skip to content

62 does not seem right to me #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zwhitchcox opened this issue Oct 11, 2019 · 4 comments
Closed

62 does not seem right to me #13

zwhitchcox opened this issue Oct 11, 2019 · 4 comments

Comments

@zwhitchcox
Copy link

The formula you gave seems incorrect to me. I know you said it's high school math, but I guess I forgot it.

It works, for the example, but I don't see how it could work for many other ones.

For example, say you have a 3x3 matrix. With your formula, it would be 3!/(3!*(3 - 3)!) = 1. It seems to me like there would be more than one way to make it down in a 3 by 3 matrix. In fact, matrix with the same number of rows and columns would equal 1 with the formula n! / r!(n-r)!.

Am I missing something here?

@zwhitchcox
Copy link
Author

Ok, so, looking at your actual code (I got stuck trying to understand the formula), it looks like you're actually using the formula [(m + n)!/max(m,n)!]/min(m,n)!. So, I guess that was the problem.

@aylei
Copy link
Owner

aylei commented Oct 11, 2019

@zwhitchcox Yes, sorry for not making it clearer, n denotes the total elements (m + n) in the formula.

@zwhitchcox
Copy link
Author

No! Don't be sorry! Thanks so much for posting your solutions, they are very helpful to me.

It makes a lot more sense now :)...had to watch a few khan academy videos though

@zwhitchcox
Copy link
Author

zwhitchcox commented Oct 11, 2019

So, the actual formula would be (m+n)!/(n!*m!)

in case anyone else has trouble with this

Vahor pushed a commit to Vahor/leetcode-rust that referenced this issue Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants