Skip to content

Day 29: Count goodStrings #22

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Day 29: Count goodStrings #22

wants to merge 1 commit into from

Conversation

thatguyintech
Copy link
Owner

rip

constructing a good string, we should not place another letter 'a' in the same
good string. And likewise, we shouldn't place letters into the good string
if they are lexicographically less than the characters that precede it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you misread the 3rd rule. note that it says "exactly one" and not "every"

return factorial(n) / (factorial(n-r) * factorial(r))

def goodStringsCount(n):
return nChooseR(26, n) * (2**n - n - 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this solution works but it doesn't follow from the examples in your ideas section

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

Successfully merging this pull request may close these issues.

2 participants