how can I system.out the all result | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

how can I system.out the all result

I have 13 words,a~m,now I want to add words to make a new words,like abcdefghijklm,abcdefghijkml,abcdefghijklm. how to system.out.the all result

16th Mar 2018, 4:50 AM
xuyexu
xuyexu - avatar
5 Answers
+ 49
U have 13 character and u want to generate words with a length of 13 character, right? So the result is 13^13 words, because there exist a formula that says that you have n results with n = <number of scope> ^ <number of positions> So you can check the result (or a part of it).
16th Mar 2018, 8:30 AM
Worm
Worm - avatar
+ 46
For me the question isn't biunique, because of that I posted this general answer Sorry, when I confounded somebody!
16th Mar 2018, 2:12 PM
Worm
Worm - avatar
+ 12
@Worm , that is when ... we can repeat the characters //and its clearly visible in examples he gave ... that he didn't repeated characters //hope U got it 👍
16th Mar 2018, 8:36 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 11
so U have 13 words ... U can make total of 13! different words by combining these 13 words . fix a word to a posn & make changes in a single posn ... using that U will be able to make it
16th Mar 2018, 5:12 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 4
https://www.geeksforgeeks.org/heaps-algorithm-for-generating-permutations/ you basically need to generate all possible permutations for n alphabets.
16th Mar 2018, 5:02 AM
shobhit
shobhit - avatar