How to create all the possibilities of a scheme with a loop?

Asked

Viewed 75 times

1

For example, make A, B, and C switch places with each other, and then define how many and all exchanges. ABC, ACB, BAC, BCA, CAB, CBA, etc. I want to do this with for and prefer Javascript, but it doesn’t have to be in it, it can be in PHP, C++, Java, etc.

NOTE: What I want to create is an RGB frame. That is, it has to have 3 variables, from 0 to 255.

  • 2

    A, B and C are integer? Are there always three elements? If yes, what would be the problem in simply always returning a fixed list with ABC, ACB, BAC, BCA, CAB and CBA?

  • http://stackoverflow.com/questions/2617055/how-to-generate-all-permutations-of-a-string-in-php

  • Thank you Daniel

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.