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

7
LINES

< > BotCompany Repo | #1025112 // intRangeStartGaps - ranges must be sorted

JavaX fragment (include)

static int[] intRangeStartGaps(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).start;
  ret a;
}

Author comment

Began life as a copy of #1025107

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: #1025112
Snippet name: intRangeStartGaps - ranges must be sorted
Eternal ID of this version: #1025112/1
Text MD5: 8c3a4228982291daff77ad3e3af9d4ef
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:19:40
Source code size: 180 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 151 / 193
Referenced in: [show references]