scala version


  • 0
    M
      def findDisappearedNumbers(nums: Array[Int]): List[Int] = {
        var set = Set.empty[Int]
        (1 to nums.length).foreach(set += _)
        for (i <- nums) set -= i
        set.toList
      }
    

Log in to reply
 

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