Skip to main content
Code Review

Return to Revisions

2 of 3
added 152 characters in body
Martin R
  • 24.2k
  • 2
  • 38
  • 96

One quick remark:

if (N === 0) return true;

can be replaced by

if (N <= 1) return true;

because in a non-empty array each element is a single "consecutive number." This saves the sorting of the array in the case \$ N = 1 \$.

Martin R
  • 24.2k
  • 2
  • 38
  • 96
default

AltStyle によって変換されたページ (->オリジナル) /