Posts

Showing posts from August, 2020

Problem15 Lattice Path

Image
                                                         Lattice paths Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. How many such routes are there through a 20×20 grid? Recursive solution that works till 16x16 grids #pragma GCC target ("avx2") #pragma GCC optimization ("Ofast") #pragma GCC optimization ("unroll-loops") #include <stdio.h> long long int n=20; long long int countPath(long long int i,long long int j) {     if(i > n || j > n)         return 0;     if(i == n && j==n)     {     ...