zhenqk
 1 public class String_intern {
 2     public static void main(String[] args) {
 3         String old="aaaaabc1";
 4         String ne="aabc1";
 5         String oak;
 6         for (int i = 0; i <ne.length() ; i++) {
 7 //z    只能取到  ne.length()      通过subString可以取到最后    ne.length()  -1
 8             for (int j = 0,z=ne.length()-i; z !=ne.length()+1 ; z++,j++) {
 9                 if(old.contains(ne.substring(j,z))){     //  substring   后开  ,z要取 大于字符串的
10                     System.out.println(ne.substring(j,z));
11                 }
12 
13             }
14 
15         }
16     }
17 }
code

java 算法之  两个字符串中最大相同的子串

分类:

技术点:

相关文章:

  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-16
  • 2021-11-13
  • 2021-11-04
  • 2021-10-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-03-01
  • 2022-02-19
  • 2022-12-23
  • 2021-07-12
  • 2022-12-23
相关资源
相似解决方案