We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
/* * Complete the 'solve' function below. * * The function is expected to return an INTEGER. * The function accepts following parameters: * 1. INTEGER n * 2. INTEGER m */constMOD=1E9+7;functionsolve(n,m){// define the matrixconstmemo=newArray(n+1).fill(null).map(el=>newArray(m+1).fill(1));// now the gridfor(leti=1;i<=n;i++){for(letj=1;j<=m;j++){memo[i][j]=(memo[i][j-1]+memo[i-1][j])%MOD;}}// this is our answerreturnmemo[n][m]}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Merge List
You are viewing a single comment's thread. Return to all comments →
JS Solution passes all test cases