sS commonSuffix(S a, S b) { int i = 0, nb = b.length(), na = a.length(), n = min(na, nb); while (i < n && a.charAt(na-1-i) == b.charAt(nb-1-i)) ++i; return i == nb ? b : substring(a, na-i); } sS commonSuffix(Iterable<S> l) { ret commonSuffixMulti(l); }
Began life as a copy of #2000379
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1013597 |
| Snippet name: | commonSuffix |
| Eternal ID of this version: | #1013597/2 |
| Text MD5: | ef0b6169ebad7d6030eb5d1602263060 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-11-02 13:11:00 |
| Source code size: | 274 bytes / 10 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 611 / 676 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |