p,ease send me a code for printing all results of a toss coin in term of head and tell using given value of n ,where n is number of coins we are used.
Print all the results of a toss coin
it is not any question i want to ask only becz i want to know this concept.
let’s say if n=2
then the output is
HH
HT
TH
TT
@ankit_verma
I cannot send you the entire code. I can discuss the concept and you should try implementing it on your own. At every step, we have two options, we can either add H to the resultant string or T to the resultant string. When you reach (n + 1), you can return. This is the base case of the recursion call. At this point, you can print the resultant string. This is the concept. Try implementing it.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.