public static String commonSuffix(String a, String b) { int i = 0; while (i < a.length() && i < b.length() && a.charAt(a.length()-1-i) == b.charAt(b.length()-1-i)) ++i; return a.substring(a.length()-i); }
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: | #2000379 |
Snippet name: | commonSuffix |
Eternal ID of this version: | #2000379/1 |
Text MD5: | 16b0e425c823160efc26853bf26d356c |
Author: | stefan |
Category: | |
Type: | New Tinybrain snippet |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-06-22 21:02:01 |
Source code size: | 233 bytes / 6 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 626 / 1530 |
Referenced in: | #698 - Standard Function Adder (new, developing) #1002427 - Accellerating 629 (SPIKE) #1006439 - lCommonSuffix #1013597 - commonSuffix #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |