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.
publicstaticintcommonChild(Strings1,Strings2){// Write your code hereint[][]dp=newint[5001][5001];for(inti=0;i<s1.length();i++){for(intj=0;j<s2.length();j++){if(s1.charAt(i)==s2.charAt(j)){dp[i+1][j+1]=dp[i][j]+1;}else{dp[i+1][j+1]=Math.max(dp[i][j+1],dp[i+1][j]);}}}returndp[s1.length()][s2.length()];}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Common Child
You are viewing a single comment's thread. Return to all comments →