Skip to content

Instantly share code, notes, and snippets.

@spreered

spreered/single_number1.rb Secret

Created Sep 13, 2017
Embed
What would you like to do?
def single_number(nums)
nums.sort!
i=0
while i< nums.length
if( nums[i]== nums[i+1] )
i=i+2
else
return nums[i]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment