private static void getCommonStrLength(String a , String b) {
int aLen = a.length();
int bLen = b.length();

int[][] dp = new int[aLen+1][bLen+1];
for (int i = 1; i <= aLen; i++) {
for (int j = 1; j <= bLen; j++) {
if(Character.toUpperCase(a.charAt(i-1)) == Character.toUpperCase(b.charAt(j-1))){
dp[i][j] = dp[i-1][j-1] + 1;
}
}
}
for (int i = 1; i <= aLen; i++) {
for (int j = 1; j <= bLen; j++) {
System.out.print(dp[i][j]+",");
}
System.out.println();
}
}

 

相关文章:

  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2021-12-17
  • 2021-11-18
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案