text: Expected Number of Trials to get N Consecutive Heads | C ++ implementation of the above approach ; Driver Code ; Formula for number of trails for N consecutive heads
code: #include " bits / stdc + + . h " NEW_LINE using namespace std ; int main ( ) { int N = 3 ; cout << pow ( 2 , N + 1 ) - 2 ; return 0 ; }