Skip to main content

Posts

Showing posts from June, 2021

Pattern

 Pascal Triangle- # include < bits / stdc ++. h > using   namespace   std ; int   main () {        ios_base :: sync_with_stdio ( false );      cin . tie ( NULL );      int   n ;      cin >> n ;      vector < int > cur ( n + 1 ), prev ( n + 1 );      for ( int   i = 1 ; i <= n ; i ++)     {         prev [ 0 ]= 1 ;        for ( int   j = 1 ; j <= i ; j ++)       {          if ( j == 1 || j == i )            cur [ j ]= prev [ j - 1 ];          else            cur [ j ]= prev [ j ]+ prev [ j - 1 ];    ...