Saturday, April 18, 2020

Fastest way to find 2 missing numbers in an array

The simple way (and pretty fast too:)
a = [1,2,3,5,7]
b = (1..7).to_a
p b-a #=> [4, 6]

No comments:

Post a Comment

Get max value for identity column without a table scan

  You can use   IDENT_CURRENT   to look up the last identity value to be inserted, e.g. IDENT_CURRENT( 'MyTable' ) However, be caut...