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)

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

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: 208 / 251
Referenced in: [show references]