Skip to content

Commit d03d929

Browse files
committed
Add two leetcode solutions - leetcode38 and leetcode 163.
1 parent 1dcd327 commit d03d929

File tree

66 files changed

+785
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+785
-0
lines changed

.vs/ProjectSettings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"CurrentProjectSetting": null
3+
}

.vs/slnx.sqlite

476 KB
Binary file not shown.
235 KB
Binary file not shown.

leetcode136/.vs/leetcode136/v16/.suo

25 KB
Binary file not shown.

leetcode136/.vs/leetcode136/v16/Server/sqlite3/db.lock

Whitespace-only changes.
644 KB
Binary file not shown.

leetcode136/leetcode136.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29009.5
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "leetcode136", "leetcode136\leetcode136.csproj", "{D786D2BA-1A65-4CB6-821F-591C532DEC2C}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{D786D2BA-1A65-4CB6-821F-591C532DEC2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{D786D2BA-1A65-4CB6-821F-591C532DEC2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{D786D2BA-1A65-4CB6-821F-591C532DEC2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{D786D2BA-1A65-4CB6-821F-591C532DEC2C}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {88C08D01-35CE-4D2F-894D-0F2BE26AFE0E}
24+
EndGlobalSection
25+
EndGlobal

leetcode136/leetcode136/Program.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
4+
namespace leetcoce136a
5+
{
6+
public class Solution
7+
{
8+
public int SingleNumber(int[] nums)
9+
{
10+
int res = 0;
11+
Dictionary<int, int> dict = new Dictionary<int, int>();
12+
foreach (var num in nums)
13+
{
14+
if (!dict.ContainsKey(num))
15+
{
16+
dict.Add(num, 1);
17+
}
18+
else
19+
dict[num]++;
20+
}
21+
22+
res = dict.FirstOrDefault(kv => kv.Value == 1).Key;
23+
24+
return res;
25+
}
26+
27+
public static void Main()
28+
{
29+
var sol = new Solution();
30+
int[] input = { 4, 1, 2, 1, 2 };
31+
32+
System.Console.WriteLine(sol.SingleNumber(input));
33+
}
34+
}
35+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"runtimeTarget": {
3+
"name": ".NETCoreApp,Version=v3.0",
4+
"signature": ""
5+
},
6+
"compilationOptions": {},
7+
"targets": {
8+
".NETCoreApp,Version=v3.0": {
9+
"leetcode136/1.0.0": {
10+
"dependencies": {
11+
"runtime.win-x64.Microsoft.NETCore.DotNetAppHost": "3.0.0-preview5-27617-04"
12+
},
13+
"runtime": {
14+
"leetcode136.dll": {}
15+
}
16+
},
17+
"runtime.win-x64.Microsoft.NETCore.DotNetAppHost/3.0.0-preview5-27617-04": {}
18+
}
19+
},
20+
"libraries": {
21+
"leetcode136/1.0.0": {
22+
"type": "project",
23+
"serviceable": false,
24+
"sha512": ""
25+
},
26+
"runtime.win-x64.Microsoft.NETCore.DotNetAppHost/3.0.0-preview5-27617-04": {
27+
"type": "package",
28+
"serviceable": true,
29+
"sha512": "sha512-x+Vg5f2FW62/TbvlN++sDmnw+rS8q0TtnTRTn0JidDqwg3fwu6F9WXn9WgtXWGINV1OO8a7UVIioMTpnwbzBOQ==",
30+
"path": "runtime.win-x64.microsoft.netcore.dotnetapphost/3.0.0-preview5-27617-04",
31+
"hashPath": "runtime.win-x64.microsoft.netcore.dotnetapphost.3.0.0-preview5-27617-04.nupkg.sha512"
32+
}
33+
}
34+
}
5.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)