Sunday, February 17, 2013

project euler problem 024

Lexicographic permutations

Permutation is a routine task for programming. STL is ideal for this problem since it has next_permutation in "algorithm".

Problem 336: Maximix Arrangements is a little bit  more difficult problem. But the idea is similar.

There is a trick to speed up these two problems. Using the same idea, the problem may be solved by hand.  

My code runs for 8ms.

No comments:

Post a Comment