Missing number(s) Interview Question Redux

后端 未结 8 814
轮回少年
轮回少年 2021-01-30 07:14

The common interview problem of determining the missing value in a range from 1 to N has been done a thousand times over. Variations include 2 missing values up to K missing val

8条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 07:53

    What about this?

    1. create your own set containing all the numbers
    2. remove the given set of numbers from your set (no need to sort)

    What's left in your set are the missing numbers.

提交回复
热议问题