Initial commit

This commit is contained in:
Electrominch
2022-10-04 13:40:57 +03:00
commit c9916dabad
34 changed files with 1289 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>_1._Two_Sum</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

10
1. Two Sum/Program.cs Normal file
View File

@@ -0,0 +1,10 @@
namespace _1._Two_Sum
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}

19
1. Two Sum/Solution.cs Normal file
View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1._Two_Sum;
public class Solution
{
public int[]? TwoSum(int[] nums, int target)
{
for (int i = 0; i < nums.Length; i++)
for (int j = i+1; j < nums.Length; j++)
if (nums[i] + nums[j] == target)
return new int[] { i, j };
return null;
}
}