Zheaoli / do-something-right

MIT License
37 stars 3 forks source link

2021-11-06 #45

Open Zheaoli opened 2 years ago

Zheaoli commented 2 years ago

2021-11-06

jingkecn commented 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 插件

Retrospection commented 2 years ago

image

Retrospection commented 2 years ago

image

Retrospection commented 2 years ago

image

Retrospection commented 2 years ago

image

Retrospection commented 2 years ago

image

Retrospection commented 2 years ago

image