Need a solution in Ruby that meets the O(n) time constraint

  • 0

    Can't think of anything faster. Below is my solution but it exceeds time constraint.
    def find_disappeared_numbers(nums)
    (1..nums.length).select { |a| nums&[a]==[] }

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.