Hi!
How can I implement the folowing:
ABC = BCA - true
BAC = CAB - true
DAB = BCA - false
if (((1 == 1) && (2 == 2) && (3==3)) || ((1==2)&&(2==1)&&(3==3)) || ..... )
return true;
That cannot be the fastest way, right??

And how can I create with a number of elements all possible combinations of them?
A, B, C, D: (unique)
ABC
ACD
ABD
BCD
The method must be very effective and fast because there's a large number of elements to check.
Thanks

Recommended Answers

All 3 Replies

Thanks, but that alogrithm would also create combinations like ABC and CBA, but thats the same.

first: check for the same length, if not, return false.
else
iterate over all the chars in the original String . if !secondString.contains(char) return false

you mean something like that?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.