public class NumArray { List<int> pre = new List<int>(); public NumArray(int[] nums) { pre.Add(0); for (int i = 0; i < nums.Length; i++) { pre.Add(pre[i] + nums[i]); } } public int SumRange(int left, int right) { right++; return pre[right] - pre[left]; } }
Standard input is empty
Welcome to .NET 6.0!
---------------------
SDK Version: 6.0.100
----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Package source with Name: nuget.org disabled successfully.
Package source with Name: local added successfully.
CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/home/4LFPKR/Project/Project.csproj]
CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/home/4LFPKR/Project/Project.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:03.94
Standard output is empty