How to find the probability of possible strings based on the input (number of rows).
Let's say we have matrix like below of order 9x3 i.e., 9 rows & 3 columns.
A B C
D E F
G H I
. . .
. . .
X Y Z
User can provide any number between 1 to 9 So, if user provides 2 (number of rows) output should look like this
AD
AE
AF
BD
BE
BF
CD
CE
CF
If user provides input 3, output should look like this
ADG
ADH
ADI
AEG
AEH
AEI
AFG
AFH
AFI
BDG
BDH
BDI
BEG
BEH
BEI
BFG
BFH
BFI
CDG
CDH
CDI
CEG
CEH
CEI
CFG
CFH
CFI
Similarly, input number of rows can be vary from 1 to 9 How can i achieve this in python ? Any best possible way ? Recently, I came across this question in one of the interview. I couldn't solve this. May be this post will be helpful for many people.