src/Recursion_Course/recursion_get.java
public static ArrayList<String> coinToss(int n) {

		if (n == 0) {
			ArrayList<String> br = new ArrayList<>();
			br.add("");
			return br;
		}

		ArrayList<String> rr = coinToss(n - 1);

		ArrayList<String> mr = new ArrayList<String>();

		for (String val : rr) {
			mr.add("H" + val);
			mr.add("T" + val);
		}

		return mr;

	}
//	print all possible outcomes of n coin tosses
print all possible outcomes of n coin tosses
print all possible outcomes of n coin tosses
public static ArrayList<String> coinToss(int n) {
		if (n == 0) {
			ArrayList<String> br = new ArrayList<>();
			br.add("");
			return br;
		}
		ArrayList<String> rr = coinToss(n - 1);
		ArrayList<String> mr = new ArrayList<String>();
		for (String val : rr) {
			mr.add("H" + val);
			mr.add("T" + val);
		}
		return mr;
	}
public static ArrayList < String > coinToss ( int n ) { if ( n == 0 ) { ArrayList < String > br = new ArrayList < > ( ) ; br . add ( "" ) ; return br ; } ArrayList < String > rr = coinToss ( n - 1 ) ; ArrayList < String > mr = new ArrayList < String > ( ) ; for ( String val : rr ) { mr . add ( "H" + val ) ; mr . add ( "T" + val ) ; } return mr ; }
print all possible outcomes of n coin tosses
print all possible outcomes of n coin tosses