Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1032818 // longestCommonSubstringsIC [not good like this]

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (3810L) is out of date.

1  
static LS longestCommonSubstringsIC(S s1, S s2) {
2  
  new LS out;
3  
  int Start = 0;
4  
  int Max = 0;
5  
  int l1 = l(s1), l2 = l(s2);
6  
  for ping (int i = 0; i < l1; i++) {
7  
    for ping (int j = 0; j < l2; j++) {
8  
      int x = 0;
9  
      while (eqic(s1.charAt(i + x), s2.charAt(j + x))) {
10  
        x++;
11  
        if ((i + x) >= l1 || (j + x) >= l2) break;
12  
      }
13  
      if (x > Max) {
14  
        out.add(substring(s1, i, i+x));
15  
        Max = x;
16  
        Start = i;
17  
      }
18  
    }
19  
  }
20  
  ret out;
21  
}

Author comment

Began life as a copy of #1032817

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032818
Snippet name: longestCommonSubstringsIC [not good like this]
Eternal ID of this version: #1032818/6
Text MD5: 82940ffb1d7f6c68986be5c314768763
Author: stefan
Category: javax / strings
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-06 11:35:44
Source code size: 497 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 77 / 102
Version history: 5 change(s)
Referenced in: [show references]