Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syareel Week 3 #58

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\v-smdsukeri\\Desktop\\MY_C-_Practise\\week3\\Syareel\\SyareelSum\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{109EB251-A7D4-4CA6-8E34-CAD4BB870FFE}|ConsoleApp1\\SyareelW3Exercise.csproj|c:\\users\\v-smdsukeri\\desktop\\my_c-_practise\\week3\\syareel\\syareelsum\\consoleapp1\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{109EB251-A7D4-4CA6-8E34-CAD4BB870FFE}|ConsoleApp1\\SyareelW3Exercise.csproj|solutionrelative:consoleapp1\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\v-smdsukeri\\Desktop\\MY_C-_Practise\\week3\\Syareel\\SyareelSum\\ConsoleApp1\\Program.cs",
"RelativeDocumentMoniker": "ConsoleApp1\\Program.cs",
"ToolTip": "C:\\Users\\v-smdsukeri\\Desktop\\MY_C-_Practise\\week3\\Syareel\\SyareelSum\\ConsoleApp1\\Program.cs",
"RelativeToolTip": "ConsoleApp1\\Program.cs",
"ViewState": "AgIAAAMAAAAAAAAAAAAqwEQAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-07T01:18:34.193Z",
"EditorCaption": ""
}
]
},
{
"DockedWidth": 124,
"SelectedChildIndex": -1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c64b9c2-e352-428e-a56d-0ace190b99a6}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}"
}
]
},
{
"DockedWidth": 124,
"SelectedChildIndex": -1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{40ea2e6b-2121-4bb8-a43e-c83c04b51041}"
}
]
}
]
}
]
}
65 changes: 65 additions & 0 deletions week3/Syareel/SyareelSum/.vs/SyareelWeek3/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\v-smdsukeri\\Desktop\\MY_C-_Practise\\week3\\Syareel\\SyareelSum\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{109EB251-A7D4-4CA6-8E34-CAD4BB870FFE}|ConsoleApp1\\SyareelW3Exercise.csproj|c:\\users\\v-smdsukeri\\desktop\\my_c-_practise\\week3\\syareel\\syareelsum\\consoleapp1\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{109EB251-A7D4-4CA6-8E34-CAD4BB870FFE}|ConsoleApp1\\SyareelW3Exercise.csproj|solutionrelative:consoleapp1\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\v-smdsukeri\\Desktop\\MY_C-_Practise\\week3\\Syareel\\SyareelSum\\ConsoleApp1\\Program.cs",
"RelativeDocumentMoniker": "ConsoleApp1\\Program.cs",
"ToolTip": "C:\\Users\\v-smdsukeri\\Desktop\\MY_C-_Practise\\week3\\Syareel\\SyareelSum\\ConsoleApp1\\Program.cs",
"RelativeToolTip": "ConsoleApp1\\Program.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-07T01:18:34.193Z",
"EditorCaption": ""
}
]
},
{
"DockedWidth": 124,
"SelectedChildIndex": -1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c64b9c2-e352-428e-a56d-0ace190b99a6}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}"
}
]
},
{
"DockedWidth": 124,
"SelectedChildIndex": -1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{40ea2e6b-2121-4bb8-a43e-c83c04b51041}"
}
]
}
]
}
]
}
68 changes: 68 additions & 0 deletions week3/Syareel/SyareelSum/ConsoleApp1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;

class Program
{
public static List<Tuple<int, int>> FindTwoSum(List<int> numbers, int target)
{
var numberIndices = new Dictionary<int, int>();
var results = new List<Tuple<int, int>>();

for (int i = 0; i < numbers.Count; i++)
{
int complement = target - numbers[i];

if (numberIndices.ContainsKey(complement))
{
results.Add(Tuple.Create(numberIndices[complement] + 1, i + 1));
}

numberIndices[numbers[i]] = i;
}

return results;
}

static void Main()
{
Console.WriteLine("Enter quantity of numbers:");
if (!int.TryParse(Console.ReadLine(), out int count) || count <= 0)
{
Console.WriteLine("Invalid input. Please enter a positive integer.");
return;
}

var numbers = new List<int>();
Console.WriteLine("Enter the numbers:");
for (int i = 0; i < count; i++)
{
if (!int.TryParse(Console.ReadLine(), out int number))
{
Console.WriteLine("Invalid input. Please enter an integer.");
return;
}
numbers.Add(number);
}

Console.WriteLine("Enter the target number:");
if (!int.TryParse(Console.ReadLine(), out int target))
{
Console.WriteLine("Invalid input. Please enter an integer.");
return;
}

var results = FindTwoSum(numbers, target);

if (results.Count > 0)
{
foreach (var result in results)
{
Console.WriteLine($"Index 1: {result.Item1}, Index 2: {result.Item2}");
}
}
else
{
Console.WriteLine("Cannot return solution");
}
}
}
10 changes: 10 additions & 0 deletions week3/Syareel/SyareelSum/ConsoleApp1/SyareelW3Exercise.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"ConsoleApp1/1.0.0": {
"runtime": {
"ConsoleApp1.dll": {}
}
}
}
},
"libraries": {
"ConsoleApp1/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"SyareelW3Exercise/1.0.0": {
"runtime": {
"SyareelW3Exercise.dll": {}
}
}
}
},
"libraries": {
"SyareelW3Exercise/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"format": 1,
"restore": {
"C:\\Users\\v-smdsukeri\\source\\repos\\ConsoleApp1\\ConsoleApp1\\ConsoleApp1.csproj": {}
},
"projects": {
"C:\\Users\\v-smdsukeri\\source\\repos\\ConsoleApp1\\ConsoleApp1\\ConsoleApp1.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\v-smdsukeri\\source\\repos\\ConsoleApp1\\ConsoleApp1\\ConsoleApp1.csproj",
"projectName": "ConsoleApp1",
"projectPath": "C:\\Users\\v-smdsukeri\\source\\repos\\ConsoleApp1\\ConsoleApp1\\ConsoleApp1.csproj",
"packagesPath": "C:\\Users\\v-smdsukeri\\.nuget\\packages\\",
"outputPath": "C:\\Users\\v-smdsukeri\\source\\repos\\ConsoleApp1\\ConsoleApp1\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\v-smdsukeri\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {},
"https://pkgs.dev.azure.com/dnceng/public/_packaging/9.0.100-preview.7.24402.8-shipping/nuget/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "all"
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.100-preview.7.24402.8/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\v-smdsukeri\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.11.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\v-smdsukeri\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
Loading