Today's problem comes from @mofodox.
Given the string "Hello world hello" how many unique (case sensitive) permutations can you find?
If you have a problem you'd like to see featured on here head over to http://www.problemotd.com/suggest/ and suggest it now!
Comments:
Anonymous - 10 years, 9 months ago
2^15
reply permalink
Zing - 10 years, 9 months ago
17! / (2! 5! 3! 2!) = 123502579200
reply permalink
heartinpiece - 10 years, 9 months ago
Yup, I came up with this answer, just that I forgot the spaces, and thus had 15!/(2!5!3!) Which is semantically wrong :)
reply permalink
Carlos - 10 years, 9 months ago
Don't be stupid as i was and read "UNIQUE permutations", the answer is indeed: 17! / (2 * 2 * 5! * 3!)
reply permalink
Shay - 10 years, 9 months ago
This problem is really ill-phrased... is it permutation of characters? of words? does it include whitespaces?
Disappointing qotd...
reply permalink
Anonymous - 10 years, 9 months ago
This was my thought. Really poorly defined question. An answer that has to be accepted is 6.
reply permalink
tehMagik - 10 years, 9 months ago
for the sake of coding, the # of permutations:
print(permutationCount)
Finding all the actual permutations: def FindPermutations(originalWord, currWord=""): global permList if len(originalWord) == 1: currWord += originalWord permList.append(currWord) return for i in range(0,len(originalWord)): perm = currWord + originalWord[i] FindPermutations(originalWord[0:i]+originalWord[i+1:], perm)
reply permalink
tehMagik - 10 years, 9 months ago
yeah...it'd be nice if we could just throw <code> in there instead of having to spam spaces. captcha is pretty damn annoying too.
reply permalink
Max Burstein - 10 years, 9 months ago
I'm working on getting a more advanced version of markdown implemented (similar to Github's) which will fix the indentation issue. Authentication is also on the todo list so you won't need to fill in a captcha each time. Hopefully I'll get some time this weekend to knock out a few things.
Thanks for your submission!
reply permalink
tehMagik - 10 years, 9 months ago
cool, thanks!
reply permalink
Jubyjoo - 10 years, 9 months ago
Hit em up with some of this:
reply permalink