First of all sort all the numbers, then our goal is to check the number of different permutations , if that numbers exceeds 5 then the answer is Yes. If you are using C++ you can easily handle everything with the next_permutation function in the library "algorithm" , if not then read about getting the next permutation of a sequence here.
No comments:
Post a Comment