1 | static Int distanceOfClosestIntTo(int value, L<Int> l) { |
2 | int lowest = -1; |
3 | for (int x : l) { |
4 | int diff = absDiff(value, x); |
5 | if (lowest < 0 || diff < lowest) lowest = diff; |
6 | } |
7 | ret lowest < 0 ? null : lowest; |
8 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018792 |
Snippet name: | distanceOfClosestIntTo |
Eternal ID of this version: | #1018792/2 |
Text MD5: | 9df591119cccb50701551d0692151525 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-13 18:56:43 |
Source code size: | 228 bytes / 8 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 321 / 355 |
Version history: | 1 change(s) |
Referenced in: | [show references] |