Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f431518
Create Python_Aswin_01.py
Ashprogrammer29 Dec 27, 2024
e3f86ae
Question 01 has been completed.
Ashprogrammer29 Dec 27, 2024
5440ca5
Question 02 has been completed.
Ashprogrammer29 Dec 27, 2024
baab1b5
Question 03 has been completed.
Ashprogrammer29 Dec 27, 2024
3b32c51
Question 01 has been completed.
Ashprogrammer29 Dec 27, 2024
58638d6
Question 02 has been completed.
Ashprogrammer29 Dec 27, 2024
96c234e
Question 03 has been completed.
Ashprogrammer29 Dec 27, 2024
a6f984f
Completed
Ashprogrammer29 Dec 27, 2024
02dc458
Completed
Ashprogrammer29 Dec 27, 2024
97fb939
Completed
Ashprogrammer29 Dec 27, 2024
fc7469f
Completed
Ashprogrammer29 Dec 27, 2024
4cfa1a4
Completed
Ashprogrammer29 Dec 27, 2024
2c791bc
Completed
Ashprogrammer29 Dec 27, 2024
364e027
Completed
Ashprogrammer29 Dec 27, 2024
661dc13
Completed
Ashprogrammer29 Dec 27, 2024
47e2066
Completed
Ashprogrammer29 Dec 27, 2024
7141b58
Completed
Ashprogrammer29 Dec 27, 2024
2a8578b
Completed
Ashprogrammer29 Dec 27, 2024
751e61e
Completed
Ashprogrammer29 Dec 27, 2024
5a4e07d
Completed
Ashprogrammer29 Dec 27, 2024
52e23af
Completed
Ashprogrammer29 Dec 27, 2024
f2cd977
Completed
Ashprogrammer29 Dec 27, 2024
8c38c17
Completed
Ashprogrammer29 Dec 27, 2024
14d8121
Completed
Ashprogrammer29 Dec 27, 2024
eb8d005
Completed
Ashprogrammer29 Dec 27, 2024
1e406c6
Completed
Ashprogrammer29 Dec 27, 2024
3da867b
Completed
Ashprogrammer29 Dec 27, 2024
b2ee2ba
Completed
Ashprogrammer29 Dec 27, 2024
6819f0d
Completed
Ashprogrammer29 Dec 27, 2024
8da6e05
Completed
Ashprogrammer29 Dec 27, 2024
7a72978
Completed
Ashprogrammer29 Dec 27, 2024
086abe9
Completed
Ashprogrammer29 Dec 27, 2024
2fb16d3
Completed
Ashprogrammer29 Dec 27, 2024
ddbaa7b
Completed
Ashprogrammer29 Dec 27, 2024
b031160
Merge branch 'SVCE-ACM:main' into main
Ashprogrammer29 Dec 28, 2024
8f25040
Completed
Ashprogrammer29 Dec 28, 2024
5fd115a
Merge branch 'SVCE-ACM:main' into main
Ashprogrammer29 Jan 1, 2025
e3a02b8
Completed
Ashprogrammer29 Jan 1, 2025
38bcb80
Completed
Ashprogrammer29 Jan 1, 2025
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
24 changes: 24 additions & 0 deletions December 01/C#_Aswin_Deivanayagam_Subramanian_01.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;

class Program
{
static int FindMissingNumber(int N, int[] array)
{
int expectedSum = N * (N + 1) / 2;
int actualSum = 0;

foreach (int num in array)
{
actualSum += num;
}

return expectedSum - actualSum;
}

static void Main()
{
// Test cases
Console.WriteLine(FindMissingNumber(5, new int[] { 1, 2, 4, 5 })); // Output: 3
Console.WriteLine(FindMissingNumber(3, new int[] { 1, 3 })); // Output: 2
}
}
25 changes: 25 additions & 0 deletions December 02/C#_Aswin_Deivanayagam_Subramanian_02.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;

class Program
{
static int[] WaveSort(int[] arr)
{
Array.Sort(arr);
for (int i = 0; i < arr.Length - 1; i += 2)
{
int temp = arr[i];
arr[i] = arr[i + 1];
arr[i + 1] = temp;
}
return arr;
}

static void Main()
{
int[] result1 = WaveSort(new int[] { 10, 5, 6, 3, 2, 20, 100, 80 });
Console.WriteLine(string.Join(", ", result1));

int[] result2 = WaveSort(new int[] { 1, 2, 3, 4, 5, 6 });
Console.WriteLine(string.Join(", ", result2));
}
}
41 changes: 41 additions & 0 deletions December 03/C#_Aswin_Deivanayagam_Subramanian_03.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Text;

class Program
{
static string AlternatingSquareArrangement(int R, int B)
{
if (Math.Abs(R - B) > 1)
{
return "Not possible";
}

StringBuilder result = new StringBuilder();
int major = R >= B ? R : B;
int minor = R >= B ? B : R;
char majorColor = R >= B ? 'R' : 'B';
char minorColor = R >= B ? 'B' : 'R';

for (int i = 0; i < major + minor; i++)
{
if (major > 0)
{
result.Append(majorColor);
major--;
}
if (minor > 0 && (result.Length == 0 || result[result.Length - 1] == majorColor))
{
result.Append(minorColor);
minor--;
}
}

return result.ToString();
}

static void Main()
{
Console.WriteLine(AlternatingSquareArrangement(3, 2));
Console.WriteLine(AlternatingSquareArrangement(4, 2));
}
}
28 changes: 28 additions & 0 deletions December 04/C#_Aswin_Deivanayagam_Subramanian_04.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;

class Program
{
static int PlantGrowthTracker(int n)
{
if (n == 1 || n == 2)
{
return 1;
}

int prev = 1, curr = 1;
for (int i = 3; i <= n; i++)
{
int temp = curr;
curr = prev + curr;
prev = temp;
}

return curr;
}

static void Main()
{
Console.WriteLine(PlantGrowthTracker(10));
Console.WriteLine(PlantGrowthTracker(12));
}
}
20 changes: 20 additions & 0 deletions December 05/C#_Aswin_Deivanayagam_Subramanian_05.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;

class Program
{
static int Josephus(int n, int k)
{
int safePosition = 0;
for (int i = 1; i <= n; i++)
{
safePosition = (safePosition + k) % i;
}
return safePosition + 1;
}

static void Main()
{
Console.WriteLine(Josephus(3, 2));
Console.WriteLine(Josephus(5, 3));
}
}
41 changes: 41 additions & 0 deletions December 06/C#_Aswin_Deivanayagam_Subramanian_06.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;

class Program
{
static List<Tuple<int, int>> TargetPairFinder(int[] numbers, int target)
{
List<Tuple<int, int>> uniquePairs = new List<Tuple<int, int>>();
HashSet<int> seen = new HashSet<int>();

foreach (int num in numbers)
{
int complement = target - num;
if (seen.Contains(complement))
{
uniquePairs.Add(new Tuple<int, int>(complement, num));
}
else
{
seen.Add(num);
}
}

return uniquePairs;
}

static void Main()
{
var result1 = TargetPairFinder(new int[] { 2, 4, 3, 7, 1, 5 }, 6);
foreach (var pair in result1)
{
Console.WriteLine($"({pair.Item1}, {pair.Item2})");
}

var result2 = TargetPairFinder(new int[] { 10, 15, 3, 7, 8, 12, 5 }, 20);
foreach (var pair in result2)
{
Console.WriteLine($"({pair.Item1}, {pair.Item2})");
}
}
}
41 changes: 41 additions & 0 deletions December 06/C#_Aswin_Deivanayagam_Subramanian_07.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;

class Program
{
static List<List<int>> GeneratePascalTriangle(int numRows)
{
List<List<int>> result = new List<List<int>>();

if (numRows == 0)
{
return result;
}

result.Add(new List<int> { 1 });

for (int i = 1; i < numRows; i++)
{
List<int> row = new List<int> { 1 };

for (int j = 1; j < i; j++)
{
row.Add(result[i - 1][j - 1] + result[i - 1][j]);
}

row.Add(1);
result.Add(row);
}

return result;
}

static void Main()
{
var triangle = GeneratePascalTriangle(5);
foreach (var row in triangle)
{
Console.WriteLine(string.Join(" ", row));
}
}
}
31 changes: 31 additions & 0 deletions December 06/C#_Aswin_Deivanayagam_Subramanian_08.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;

class Program
{
static int DigitSquareSum(int N)
{
int DigitSquareSumOfNumber(int num)
{
int total = 0;
while (num > 0)
{
int digit = num % 10;
total += digit * digit;
num /= 10;
}
return total;
}

int totalSum = 0;
for (int i = 1; i <= N; i++)
{
totalSum += DigitSquareSumOfNumber(i);
}
return totalSum;
}

static void Main()
{
Console.WriteLine(DigitSquareSum(10)); // Example usage
}
}
41 changes: 41 additions & 0 deletions December 07/C#_Aswin_Deivanayagam_Subramanian_07.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;

class Program
{
static List<List<int>> GeneratePascalTriangle(int numRows)
{
List<List<int>> result = new List<List<int>>();

if (numRows == 0)
{
return result;
}

result.Add(new List<int> { 1 });

for (int i = 1; i < numRows; i++)
{
List<int> row = new List<int> { 1 };

for (int j = 1; j < i; j++)
{
row.Add(result[i - 1][j - 1] + result[i - 1][j]);
}

row.Add(1);
result.Add(row);
}

return result;
}

static void Main()
{
var triangle = GeneratePascalTriangle(5);
foreach (var row in triangle)
{
Console.WriteLine(string.Join(" ", row));
}
}
}
31 changes: 31 additions & 0 deletions December 08/C#_Aswin_Deivanayagam_Subramanian_08.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;

class Program
{
static int DigitSquareSum(int N)
{
int DigitSquareSumOfNumber(int num)
{
int total = 0;
while (num > 0)
{
int digit = num % 10;
total += digit * digit;
num /= 10;
}
return total;
}

int totalSum = 0;
for (int i = 1; i <= N; i++)
{
totalSum += DigitSquareSumOfNumber(i);
}
return totalSum;
}

static void Main()
{
Console.WriteLine(DigitSquareSum(10)); // Example usage
}
}
15 changes: 15 additions & 0 deletions December 09/C#_Aswin_Deivanayagam_Subramanian_09.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Linq;

class Program
{
static int CountCustomersWithOneReturn(int[] returns)
{
return returns.Count(r => r == 1);
}

static void Main()
{
Console.WriteLine(CountCustomersWithOneReturn(new int[] { 1, 2, 1, 3, 1 })); // Example usage
}
}
Loading