diff --git a/30Days/Day-0/Problem Statement/30-hello-world-English.pdf b/30Days/Day-0/Problem Statement/30-hello-world-English.pdf new file mode 100644 index 0000000..df6d7c1 Binary files /dev/null and b/30Days/Day-0/Problem Statement/30-hello-world-English.pdf differ diff --git a/30Days/Day-0/Solutions/cshap.cs b/30Days/Day-0/Solutions/cshap.cs new file mode 100644 index 0000000..4e35ef3 --- /dev/null +++ b/30Days/Day-0/Solutions/cshap.cs @@ -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. + } +} diff --git a/30Days/Day-0/Solutions/python.py b/30Days/Day-0/Solutions/python.py new file mode 100644 index 0000000..e69de29 diff --git a/30Days/Day-1/Problem Statement/30-data-types-English.pdf b/30Days/Day-1/Problem Statement/30-data-types-English.pdf new file mode 100644 index 0000000..6807004 Binary files /dev/null and b/30Days/Day-1/Problem Statement/30-data-types-English.pdf differ diff --git a/30Days/Day-1/Solutions/python.py b/30Days/Day-1/Solutions/python.py new file mode 100644 index 0000000..9b9c36d --- /dev/null +++ b/30Days/Day-1/Solutions/python.py @@ -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) \ No newline at end of file diff --git a/30Days/Day-11/Problem Statement/30-2d-arrays-English.pdf b/30Days/Day-11/Problem Statement/30-2d-arrays-English.pdf new file mode 100644 index 0000000..142b15d Binary files /dev/null and b/30Days/Day-11/Problem Statement/30-2d-arrays-English.pdf differ diff --git a/30Days/Day-11/Solutions/python.py b/30Days/Day-11/Solutions/python.py new file mode 100644 index 0000000..7682efb --- /dev/null +++ b/30Days/Day-11/Solutions/python.py @@ -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) \ No newline at end of file diff --git a/30Days/Day-2/Problem Statement/30-operators-English.pdf b/30Days/Day-2/Problem Statement/30-operators-English.pdf new file mode 100644 index 0000000..179283e Binary files /dev/null and b/30Days/Day-2/Problem Statement/30-operators-English.pdf differ diff --git a/30Days/Day-2/Solutions/python.py b/30Days/Day-2/Solutions/python.py new file mode 100644 index 0000000..217ed86 --- /dev/null +++ b/30Days/Day-2/Solutions/python.py @@ -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) \ No newline at end of file diff --git a/30Days/Day-3/Problem Statement/30-conditional-statements-English.pdf b/30Days/Day-3/Problem Statement/30-conditional-statements-English.pdf new file mode 100644 index 0000000..34f03be Binary files /dev/null and b/30Days/Day-3/Problem Statement/30-conditional-statements-English.pdf differ diff --git a/30Days/Day-3/Solutions/python.py b/30Days/Day-3/Solutions/python.py new file mode 100644 index 0000000..9618526 --- /dev/null +++ b/30Days/Day-3/Solutions/python.py @@ -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") + diff --git a/30Days/Day-4/Problem Statement/30-class-vs-instance-English.pdf b/30Days/Day-4/Problem Statement/30-class-vs-instance-English.pdf new file mode 100644 index 0000000..a93806c Binary files /dev/null and b/30Days/Day-4/Problem Statement/30-class-vs-instance-English.pdf differ diff --git a/30Days/Day-4/Solutions/python.py b/30Days/Day-4/Solutions/python.py new file mode 100644 index 0000000..2b74181 --- /dev/null +++ b/30Days/Day-4/Solutions/python.py @@ -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 \ No newline at end of file diff --git a/30Days/Day-5/Problem Statement/30-loops-English.pdf b/30Days/Day-5/Problem Statement/30-loops-English.pdf new file mode 100644 index 0000000..51443d2 Binary files /dev/null and b/30Days/Day-5/Problem Statement/30-loops-English.pdf differ diff --git a/30Days/Day-5/Solutions/python.py b/30Days/Day-5/Solutions/python.py new file mode 100644 index 0000000..f080025 --- /dev/null +++ b/30Days/Day-5/Solutions/python.py @@ -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)) \ No newline at end of file diff --git a/30Days/Day-6/Problem Statement/30-review-loop-English.pdf b/30Days/Day-6/Problem Statement/30-review-loop-English.pdf new file mode 100644 index 0000000..8e44d37 Binary files /dev/null and b/30Days/Day-6/Problem Statement/30-review-loop-English.pdf differ diff --git a/30Days/Day-6/Solutions/csharp.cs b/30Days/Day-6/Solutions/csharp.cs new file mode 100644 index 0000000..b307af2 --- /dev/null +++ b/30Days/Day-6/Solutions/csharp.cs @@ -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 = ""; + } + + } + } +} diff --git a/30Days/Day-7/Problem Statement/30-arrays-English.pdf b/30Days/Day-7/Problem Statement/30-arrays-English.pdf new file mode 100644 index 0000000..13c100f Binary files /dev/null and b/30Days/Day-7/Problem Statement/30-arrays-English.pdf differ diff --git a/30Days/Day-7/Solutions/python.py b/30Days/Day-7/Solutions/python.py new file mode 100644 index 0000000..df476c0 --- /dev/null +++ b/30Days/Day-7/Solutions/python.py @@ -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=" ") diff --git a/30Days/Day-8/Problem Statement/30-dictionaries-and-maps-English.pdf b/30Days/Day-8/Problem Statement/30-dictionaries-and-maps-English.pdf new file mode 100644 index 0000000..e65c05d Binary files /dev/null and b/30Days/Day-8/Problem Statement/30-dictionaries-and-maps-English.pdf differ diff --git a/30Days/Day-8/Solutions/python.py b/30Days/Day-8/Solutions/python.py new file mode 100644 index 0000000..d08cab0 --- /dev/null +++ b/30Days/Day-8/Solutions/python.py @@ -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") \ No newline at end of file diff --git a/algorithms/Implementation/10-BonAppetit/ProblemStatement/bon-appetit-English.pdf b/algorithms/Implementation/10-BonAppetit/ProblemStatement/bon-appetit-English.pdf new file mode 100644 index 0000000..a6b5f85 Binary files /dev/null and b/algorithms/Implementation/10-BonAppetit/ProblemStatement/bon-appetit-English.pdf differ diff --git a/algorithms/Implementation/10-BonAppetit/Solutions/python.py b/algorithms/Implementation/10-BonAppetit/Solutions/python.py new file mode 100644 index 0000000..8e7fb9c --- /dev/null +++ b/algorithms/Implementation/10-BonAppetit/Solutions/python.py @@ -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) \ No newline at end of file diff --git a/algorithms/Implementation/11-SockMerchant/ProblemStatement/sock-merchant-English.pdf b/algorithms/Implementation/11-SockMerchant/ProblemStatement/sock-merchant-English.pdf new file mode 100644 index 0000000..f1d6378 Binary files /dev/null and b/algorithms/Implementation/11-SockMerchant/ProblemStatement/sock-merchant-English.pdf differ diff --git a/algorithms/Implementation/11-SockMerchant/Solutions/python.py b/algorithms/Implementation/11-SockMerchant/Solutions/python.py new file mode 100644 index 0000000..d06023d --- /dev/null +++ b/algorithms/Implementation/11-SockMerchant/Solutions/python.py @@ -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) diff --git a/algorithms/Implementation/6-BirthdayChocolate/ProblemStatement/the-birthday-bar-English.pdf b/algorithms/Implementation/6-BirthdayChocolate/ProblemStatement/the-birthday-bar-English.pdf new file mode 100644 index 0000000..3f37b0c Binary files /dev/null and b/algorithms/Implementation/6-BirthdayChocolate/ProblemStatement/the-birthday-bar-English.pdf differ diff --git a/algorithms/Implementation/6-BirthdayChocolate/Solutions/python.py b/algorithms/Implementation/6-BirthdayChocolate/Solutions/python.py new file mode 100644 index 0000000..8b84180 --- /dev/null +++ b/algorithms/Implementation/6-BirthdayChocolate/Solutions/python.py @@ -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) diff --git a/algorithms/Implementation/7-DivisibleSumPairs/ProblemStatement/divisible-sum-pairs-English.pdf b/algorithms/Implementation/7-DivisibleSumPairs/ProblemStatement/divisible-sum-pairs-English.pdf new file mode 100644 index 0000000..365e9b7 Binary files /dev/null and b/algorithms/Implementation/7-DivisibleSumPairs/ProblemStatement/divisible-sum-pairs-English.pdf differ diff --git a/algorithms/Implementation/7-DivisibleSumPairs/Solutions/python.py b/algorithms/Implementation/7-DivisibleSumPairs/Solutions/python.py new file mode 100644 index 0000000..3da5e71 --- /dev/null +++ b/algorithms/Implementation/7-DivisibleSumPairs/Solutions/python.py @@ -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) diff --git a/algorithms/Implementation/8-MigratoryBirds/ProblemStatement/migratory-birds-English.pdf b/algorithms/Implementation/8-MigratoryBirds/ProblemStatement/migratory-birds-English.pdf new file mode 100644 index 0000000..247fda7 Binary files /dev/null and b/algorithms/Implementation/8-MigratoryBirds/ProblemStatement/migratory-birds-English.pdf differ diff --git a/algorithms/Implementation/8-MigratoryBirds/Solutions/python.py b/algorithms/Implementation/8-MigratoryBirds/Solutions/python.py new file mode 100644 index 0000000..7540d4f --- /dev/null +++ b/algorithms/Implementation/8-MigratoryBirds/Solutions/python.py @@ -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) diff --git a/algorithms/Sorting/1-IntroToTutorialChallenges/ProblemStatement/tutorial-intro-English.pdf b/algorithms/Sorting/1-IntroToTutorialChallenges/ProblemStatement/tutorial-intro-English.pdf new file mode 100644 index 0000000..d6ec1ef Binary files /dev/null and b/algorithms/Sorting/1-IntroToTutorialChallenges/ProblemStatement/tutorial-intro-English.pdf differ diff --git a/algorithms/Sorting/1-IntroToTutorialChallenges/Solutions/python.py b/algorithms/Sorting/1-IntroToTutorialChallenges/Solutions/python.py new file mode 100644 index 0000000..0ffeff2 --- /dev/null +++ b/algorithms/Sorting/1-IntroToTutorialChallenges/Solutions/python.py @@ -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) diff --git a/algorithms/Sorting/2-InsertionSortPart1/ProblemStatement/insertionsort1-English.pdf b/algorithms/Sorting/2-InsertionSortPart1/ProblemStatement/insertionsort1-English.pdf new file mode 100644 index 0000000..c4c1e1d Binary files /dev/null and b/algorithms/Sorting/2-InsertionSortPart1/ProblemStatement/insertionsort1-English.pdf differ diff --git a/algorithms/Sorting/2-InsertionSortPart1/Solutions/python.py b/algorithms/Sorting/2-InsertionSortPart1/Solutions/python.py new file mode 100644 index 0000000..926bf68 --- /dev/null +++ b/algorithms/Sorting/2-InsertionSortPart1/Solutions/python.py @@ -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) diff --git a/algorithms/Sorting/3-InsertionSortPart2/ProblemStatement/insertionsort2-English.pdf b/algorithms/Sorting/3-InsertionSortPart2/ProblemStatement/insertionsort2-English.pdf new file mode 100644 index 0000000..8e20405 Binary files /dev/null and b/algorithms/Sorting/3-InsertionSortPart2/ProblemStatement/insertionsort2-English.pdf differ diff --git a/algorithms/Sorting/3-InsertionSortPart2/Solutions/python.py b/algorithms/Sorting/3-InsertionSortPart2/Solutions/python.py new file mode 100644 index 0000000..1779fc9 --- /dev/null +++ b/algorithms/Sorting/3-InsertionSortPart2/Solutions/python.py @@ -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) diff --git a/algorithms/Sorting/4-CorrectnessAndTheLoopInvariant/ProblemStatement/correctness-invariant-English.pdf b/algorithms/Sorting/4-CorrectnessAndTheLoopInvariant/ProblemStatement/correctness-invariant-English.pdf new file mode 100644 index 0000000..3abd150 Binary files /dev/null and b/algorithms/Sorting/4-CorrectnessAndTheLoopInvariant/ProblemStatement/correctness-invariant-English.pdf differ diff --git a/algorithms/Sorting/4-CorrectnessAndTheLoopInvariant/Solutions/python.py b/algorithms/Sorting/4-CorrectnessAndTheLoopInvariant/Solutions/python.py new file mode 100644 index 0000000..7523096 --- /dev/null +++ b/algorithms/Sorting/4-CorrectnessAndTheLoopInvariant/Solutions/python.py @@ -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))) diff --git a/algorithms/Sorting/5-QuickSort1-Partition/ProblemStatement/quicksort1-English.pdf b/algorithms/Sorting/5-QuickSort1-Partition/ProblemStatement/quicksort1-English.pdf new file mode 100644 index 0000000..472d7b0 Binary files /dev/null and b/algorithms/Sorting/5-QuickSort1-Partition/ProblemStatement/quicksort1-English.pdf differ diff --git a/algorithms/Sorting/5-QuickSort1-Partition/Solutions/python.py b/algorithms/Sorting/5-QuickSort1-Partition/Solutions/python.py new file mode 100644 index 0000000..5d1c978 --- /dev/null +++ b/algorithms/Sorting/5-QuickSort1-Partition/Solutions/python.py @@ -0,0 +1,31 @@ +#!/bin/python3 + +import sys + +def quickSort(arr): + left = [] + equal = [] + right = [] + pivot = arr[0] + for x in arr: + if x == pivot: + equal.append(x) + elif x > pivot: + right.append(x) + else: + left.append(x) + + arr[:] =[] + arr += left + arr += equal + arr += right + return arr + + +if __name__ == "__main__": + n = int(input().strip()) + arr = list(map(int, input().strip().split(' '))) + result = quickSort(arr) + print (" ".join(map(str, result))) + + diff --git a/algorithms/Strings/CamelCase/ProblemStatement/camelcase-English.pdf b/algorithms/Strings/CamelCase/ProblemStatement/camelcase-English.pdf new file mode 100644 index 0000000..f58ba03 Binary files /dev/null and b/algorithms/Strings/CamelCase/ProblemStatement/camelcase-English.pdf differ diff --git a/algorithms/Strings/CamelCase/Solutions/python.py b/algorithms/Strings/CamelCase/Solutions/python.py new file mode 100644 index 0000000..8710e28 --- /dev/null +++ b/algorithms/Strings/CamelCase/Solutions/python.py @@ -0,0 +1,11 @@ +#!/bin/python3 + +import sys + +def camelcase(s): + return sum(1 for c in s if c.isupper()) + 1 + +if __name__ == "__main__": + s = input().strip() + result = camelcase(s) + print(result)