缺失数字

来自qingwei personal wiki
Qingwei讨论 | 贡献2018年6月4日 (一) 04:52的版本
跳转至: 导航搜索

描述

leetcode

https://leetcode-cn.com/problems/missing-number/description/

问题

给定一个包含 0, 1, 2, ..., n 中 n 个数的序列,找出 0 .. n 中没有出现在序列中的那个数。

示例 1:

输入: [3,0,1]
输出: 2
示例 2:

输入: [9,6,4,2,3,5,7,0,1]
输出: 8