Count N | C # program to implement the above approach ; Function to count N - length strings consisting of vowels only sorted lexicographically ; Stores count of strings consisting of vowels sorted lexicographically of all possible lengths ; Initialize DP [ 1 ] [ 1 ] ; Traverse the matrix row - wise ; Base Case ; Return the result ; Driver Code ; Function Call
using System ; class GFG { static int findNumberOfStrings ( int n ) { int [ , ] DP = new int [ n + 1 , 6 ] ; DP [ 1 , 1 ] = 1 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { for ( int j = 1 ; j < 6 ; j ++ ) { if ( i == 1 ) { DP [ i , j ] = DP [ i , j - 1 ] + 1 ; } else { DP [ i , j ] = DP [ i , j - 1 ] + DP [ i - 1 , j ] ; } } } return DP [ n , 5 ] ; } public static void Main ( string [ ] args ) { int N = 2 ; Console . Write ( findNumberOfStrings ( N ) ) ; } }