Open Zheaoli opened 2 years ago
/*
* @lc app=leetcode.cn id=268 lang=csharp
*
* [268] 丢失的数字
*/
// @lc code=start
public class Solution {
public int MissingNumber(int[] nums) {
var result = 0;
for (int i = 0; i <= nums.Length; i++)
{
result += i;
}
foreach (var num in nums)
{
result -= num;
}
return result;
}
}
// @lc code=end
来自 vscode 插件
2021-11-06