In how many ways the ball will come back to the first boy after N turns | Function to return the number of sequences that get back to Bob ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int numSeq ( int n ) { return ( pow ( 3 , n ) + 3 * pow ( -1 , n ) ) / 4 ; } int main ( ) { int N = 10 ; printf ( " % d " , numSeq ( N ) ) ; return 0 ; }