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

6
LINES

< > BotCompany Repo | #2000378 // commonPrefix

New Tinybrain snippet

  public static String commonPrefix(String a, String b) {
    int i = 0;
    while (i < a.length() && i < b.length() && a.charAt(i) == b.charAt(i))
      ++i;
    return a.substring(0, i);
  }

download  show line numbers   

Snippet is not live.

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #2000378
Snippet name: commonPrefix
Eternal ID of this version: #2000378/1
Text MD5: 7458b1c05eaa9ba7bba684cd7ee0bbf2
Author: stefan
Category:
Type: New Tinybrain snippet
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-06-22 20:56:16
Source code size: 199 bytes / 6 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 673 / 2282
Referenced in: [show references]