Skip to content
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.
15 changes: 15 additions & 0 deletions 30Days/Day-0/Solutions/cshap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Solution {
static void Main(String[] args) {
// Declare a variable named 'inputString' to hold our input.
String inputString;

// Read a full line of input from stdin (cin) and save it to our variable, input_string.
inputString = Console.ReadLine();

// Print a string literal saying "Hello, World." to stdout using cout.
Console.WriteLine("Hello, World.");
Console.WriteLine(inputString);

// TODO: Write a line of code here that prints the contents of input_string to stdout.
}
}
Empty file.
Binary file not shown.
7 changes: 7 additions & 0 deletions 30Days/Day-1/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
secInt = int(input().strip())
secDoub = float(input().strip())
secString = (input())
# Declare second integer, double, and String variables.
print(secInt + i)
print(secDoub + d)
print(s + secString)
Binary file not shown.
24 changes: 24 additions & 0 deletions 30Days/Day-11/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/python3

import sys

arr = []
hourGlass = []
def getHourglass(arr):
highest = -1000
for k in range(len(arr)-2):
for x in range(len(arr)-2):
top = arr[k][x:3+x]
middle = arr[1+k][x+1:2+x]
bottom = arr[2+k][x:3+x]
totalGeral = sum(top+middle+bottom)

if totalGeral > highest:
highest = totalGeral

print(highest)

for arr_i in range(6):
arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')]
arr.append(arr_t)
getHourglass(arr)
Binary file not shown.
15 changes: 15 additions & 0 deletions 30Days/Day-2/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/python3

import sys
def calculate(meal_cost, tip_percent, tax_percent):
tip = meal_cost * (tip_percent/100)
tax = meal_cost * (tax_percent/100)
totalCost = float(meal_cost + tip + tax)
print("The total meal cost is " + str(round(totalCost)) + " dollars.")


if __name__ == "__main__":
meal_cost = float(input().strip())
tip_percent = int(input().strip())
tax_percent = int(input().strip())
calculate(meal_cost, tip_percent, tax_percent)
Binary file not shown.
18 changes: 18 additions & 0 deletions 30Days/Day-3/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/python3

import sys


N = int(input().strip())

if N%2 != 0:
print("Weird")

elif N%2 == 0:
if N >= 2 and N <= 5:
print("Not Weird")
if N >= 6 and N <= 20:
print("Weird")
if N > 20:
print("Not Weird")

Binary file not shown.
15 changes: 15 additions & 0 deletions 30Days/Day-4/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Person:
def __init__(self,initialAge):
if initialAge < 0:
age = 0
print("Age is not valid, setting age to 0.")
def amIOld(self):
if age < 13:
print("You are young.")
elif age >= 13 and age < 18:
print("You are a teenager.")
else:
print("You are old.")
def yearPasses(self):
global age
age += 1
Binary file not shown.
8 changes: 8 additions & 0 deletions 30Days/Day-5/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/python3

import sys


n = int(input().strip())
for x in range(1,11):
print(str(n) +" x "+str(x) + " = " + str(x*n))
Binary file not shown.
38 changes: 38 additions & 0 deletions 30Days/Day-6/Solutions/csharp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
class Program
{
static void Main(string[] args)

{
string a = "", b = "";
int t = Convert.ToInt32(Console.ReadLine());
for(int i = 0; i < t; i++)
{
string x = Console.ReadLine();
x.ToCharArray();
for (int k = 0; k < x.Length; k ++)
{
if(k % 2 == 0)
{
a = a + x[k].ToString();
}
else
{
b = b + x[k].ToString();
}
}
Console.WriteLine($"{a} {b}");
a = "";
b = "";
}

}
}
}
Binary file not shown.
9 changes: 9 additions & 0 deletions 30Days/Day-7/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/python3

import sys


n = int(input().strip())
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
for element in reversed(arr):
print(element, end=" ")
Binary file not shown.
12 changes: 12 additions & 0 deletions 30Days/Day-8/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
n = int(input())
dic = {}
for _ in range(n):
list_input = list(input().rstrip().split())
dic[aplist_inputple[0]] = list_input[1]

while True:
inp = input()
if inp != "" and inp in dic:
print(inp + "=" + dic[inp])
else:
print("Not found")
Binary file not shown.
14 changes: 14 additions & 0 deletions algorithms/Implementation/10-BonAppetit/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
firstLine = list(map(int, input().rstrip().split()))
costOfFood = list(map(int, input().rstrip().split()))
charged = int(input())

deal = 0

def JudgeOfCost(firstLine,costOfFood, charged):
deal = ((sum(costOfFood) - costOfFood[firstLine[1]])/2)
if (charged - deal == 0):
print("Bon Appetit")
else:
print(int(charged - deal))

JudgeOfCost(firstLine, costOfFood, charged)
Binary file not shown.
16 changes: 16 additions & 0 deletions algorithms/Implementation/11-SockMerchant/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/python3

import sys
from collections import *
def sockMerchant(n, ar):
numberOfPairs = 0
c = Counter(ar)
for k in c:
numberOfPairs += c[k]//2
return(numberOfPairs)


n = int(input().strip())
ar = list(map(int, input().strip().split(' ')))
result = sockMerchant(n, ar)
print(result)
Binary file not shown.
34 changes: 34 additions & 0 deletions algorithms/Implementation/6-BirthdayChocolate/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/python3

import sys

def solve(n, s, d, m):
if m > n:
return 0

i = j = 0
window_sum = 0

while j < m:
window_sum += s[j]
j += 1

count = 1 if window_sum == d else 0

while j < n:
window_sum -= s[i]
window_sum += s[j]

if window_sum == d:
count += 1
i += 1
j += 1

return count

n = int(input().strip())
s = list(map(int, input().strip().split(' ')))
d, m = input().strip().split(' ')
d, m = [int(d), int(m)]
result = solve(n, s, d, m)
print(result)
Binary file not shown.
27 changes: 27 additions & 0 deletions algorithms/Implementation/7-DivisibleSumPairs/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/python3

import sys

def divisibleSumPairs(n, k, ar):
count = 0
arrPairs = []

for x in range(len(ar)):
j = 1
while j < len(ar):
pair = []
if x < j and ((ar[x] + ar[j]) % k == 0):
pair.append(x)
pair.append(j)
if pair not in arrPairs:
arrPairs.append(pair)
count += 1
j += 1
return count


n, k = input().strip().split(' ')
n, k = [int(n), int(k)]
ar = list(map(int, input().strip().split(' ')))
result = divisibleSumPairs( n, k, ar)
print(result)
Binary file not shown.
13 changes: 13 additions & 0 deletions algorithms/Implementation/8-MigratoryBirds/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/python3

import sys
from collections import *

def migratoryBirds(n, ar):
c = Counter(ar).most_common(1)
return (c[0][0])

n = int(input().strip())
ar = list(map(int, input().strip().split(' ')))
result = migratoryBirds(n, ar)
print(result)
Binary file not shown.
13 changes: 13 additions & 0 deletions algorithms/Sorting/1-IntroToTutorialChallenges/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/python3

import sys

def introTutorial(V, arr):
return(arr.index(V))

if __name__ == "__main__":
V = int(input().strip())
n = int(input().strip())
arr = list(map(int, input().strip().split(' ')))
result = introTutorial(V, arr)
print(result)
Binary file not shown.
30 changes: 30 additions & 0 deletions algorithms/Sorting/2-InsertionSortPart1/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/python3

import sys

def insertionSort1(n, arr):
last = arr[-1]
last = arr[-1]
x = 0
while arr[n-(n+2) - x] > last:
arr[-1-x] = arr[n-(n+2) - x]
print (' '.join(str(y) for y in arr))
if x+2 == len(arr):
arr[n-(n+2) - x] = last
break
else:
x += 1

if arr[n-(n+2) - x] < last:
arr[-x-1] = last
print (' '.join(str(y) for y in arr))
else:
print (' '.join(str(y) for y in arr))




if __name__ == "__main__":
n = int(input().strip())
arr = list(map(int, input().strip().split(' ')))
insertionSort1(n, arr)
Binary file not shown.
21 changes: 21 additions & 0 deletions algorithms/Sorting/3-InsertionSortPart2/Solutions/python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/python3

import sys

def insertionSort2(n, l):
for i in range(1, len(l)):
j = i-1
key = l[i]
while (j >= 0) and (l[j] > key):
l[j+1],l[j] = l[j],l[j+1]
j -= 1
l[j+1] = key
print(" ".join(map(str,l)))




if __name__ == "__main__":
n = int(input().strip())
arr = list(map(int, input().strip().split(' ')))
insertionSort2(n, arr)
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def insertion_sort(l):
for i in range(1, len(l)):
j = i-1
key = l[i]
while (j >= 0) and (l[j] > key):
l[j+1] = l[j]
j -= 1
l[j+1] = key


m = int(input().strip())
ar = [int(i) for i in input().strip().split()]
insertion_sort(ar)
print(" ".join(map(str,ar)))
Binary file not shown.
Loading