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

7
LINES

< > BotCompany Repo | #1025107 // intRangeGaps - ranges must be sorted

JavaX fragment (include)

1  
static int[] intRangeGaps(L<IntRange> l) {
2  
  int n = l(l)-1;
3  
  if (n <= 0) null;
4  
  int[] a = new int[n];
5  
  for i to n: a[i] = l.get(i+1).start-l.get(i).end;
6  
  ret a;
7  
}

Author comment

Began life as a copy of #1025106

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025107
Snippet name: intRangeGaps - ranges must be sorted
Eternal ID of this version: #1025107/1
Text MD5: 1955eb4329f847cbedd068c9c999d392
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-05 19:03:23
Source code size: 173 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 209 / 253
Referenced in: [show references]