Libraryless. Click here for Pure Java version (37L/1K).
1 | sclass IntMinMax {
|
2 | int min = Int.MAX_VALUE, max = Int.MIN_VALUE; |
3 | |
4 | void add(int i) {
|
5 | if (i < min) min = i; |
6 | if (i > max) max = i; |
7 | } |
8 | |
9 | int rangeLength() { ret max-min; }
|
10 | } |
Began life as a copy of #1034025
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034026 |
| Snippet name: | IntMinMax - collect minimum and maximum value |
| Eternal ID of this version: | #1034026/2 |
| Text MD5: | 4c48839d114992f78b6c577fe73a4ef6 |
| Transpilation MD5: | 0a74df4295f807b13212b1658cb6c9ed |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-01-17 17:59:18 |
| Source code size: | 196 bytes / 10 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 363 / 504 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |