Skip to content
Advertisement

Pythonic Way to Get Unique Neighboring Integers in an Ordered List

Given an ordered integer list, return the largest integer less than N and smallest integer greater than N. If there is none for one, just print “X”.

Advertisement

Answer

As far as I know, this is the fastest solution possible.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement