Note: While doing this challenge, my goal is to learn another program langauge such as C and write algorithms using that new language instead. My goal is to switch the syntax every 20 days of algorithms. #challengeWithATwist
Day 0: March 13, 2017
- 1_simpleSum: A simple program that takes the sum based on user input, 0 will stop it from adding numbers.
Day 1: March 14, 2017
- 2_solveMeFirst: A simple program that takes two integers and returns a sum.
- 3_compareTheTriplets: Takes six integers from users, compares them in a point system to see who has more points.
Day 2: March 15, 2017
- 4_aVeryBigSum: Take Two inputs, first being the array size, second being the values, values should be larger than 10 digits.
- 5_diagonalDifference: Given a square matrix of size N calculate the absolute difference between the sums of its diagonals.
Day 3: March 16, 2017
- 6_PlusMinus: Given an array of integers, calculate which fraction of its elements are positive, negative, and zeroes, respectively. Print the decimal value of each fraction on a new line, only up to six digits after decimal acceptable
- 7_Staircase: Observe that its base and height are both equal to N and the image is drawn using # symbols and spaces. The last line is not preceded by any spaces.
Day 4: March 17, 2017
- 8_MiniMaxSum: Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers.
Day 5: March 18, 2017
- 9_TimeConversion: Convert AM/PM time to military time.
Day 6: March 19, 2017
- 10_ExtraLongFactorials: You are given an integer N Print the factorial of this number.
Day 7: March 20, 2017
- 11_AppendAndDelete: Given two strings and K --> Number of Operations. You can do two operations Append or Delete a character. See if you can convert string s to string t with those the given number of operations and using only Append and Delete.
Day 8: March 21, 2017
- 12_SherlockAndSquares: Given an integer, which is the number of test cases then two integers A and B, find the number of square roots in the range of A and B
Day 9: March 22, 2017
- 13_LibraryFine: Calculate fine with given conditions:
- If the book is returned on or before the expected return date, no fine will be charged
- If the book is returned after the expected return day but still within the same calendar month and year as the expected return date 15 x number of days late
- If the book is returned after the expected return month but still within the same calendar year as the expected return date, the 500 x number of months later
- If the book is returned after the calendar year in which it was expected, there is a fixed fine of 10000
Day 10: March 23, 2017*
You are given N sticks, where the length of each stick is a positive integer. A cut operation is performed on the sticks such that all of them are reduced by the length of the smallest stick.
Day 11: March 24, 2017*
HackerLand University has the following grading policy:
- Every student receives a grade in the inclusive range from 0 to 100
- Any grade less than 40 is a failing grade.
Sam is a professor at the university and likes to round each student's grade according to these rules:
- If the difference between the grade and the next multiple of 5 is less than 3, round grade up to the next multiple of 5
- If the value of grade is less than 38, no rounding occurs as the result will still be a failing grade.
For example, grade = 84 will be rounded to 85 but grade = 29 will not be rounded because the rounding would result in a number that is less than 40
Given the initial value of grade for each of Sam's students, write code to automate the rounding process. For each , round it according to the rules above and print the result on a new line.
Day 12: March 25, 2017*
Steve has a string,s, consisting of n lowercase English alphabetic letters. In one operation, he can delete any pair of adjacent letters with same value. For example, string "aabcc"
would become either "aab"
or "bcc"
after 1 operation.
Steve wants to reduce s as much as possible. To do this, he will repeat the above operation as many times as it can be performed. Help Steve out by finding and printing s's non-reducible form!
Note: If the final string is empty, print Empty String
.
Day 14: March 27, 2017*
- 18_MarsExploration.java: Letters in some SOS messages are altered by cosmic radiation during transmission. Given the signal received by Earth as a string, S , determine how many letters of SOS have been changed by radiation.
Day 15: March 28, 2017*
- 19_HackerrankInAString.java: Given a string, print
YES
if the string contains 'hackerrank', else printNO
.
Day 16: March 29. 2017*
- 20_Pangrams.java: Given a sentence, check if it is a Pangram (using every letter in the alphabet). If it does, print
pangram
else printnot pangram
.
Day --: March 30,2017*
Midterm Studying, did not do daily algorithm due to studying.
Day 18: April 1, 2017
Day 19: April 2, 2017
Day 20: April 3, 2017
- 24_AlternatingCharacters.java: Given a string, find out the number of deletions required to make the letters in the string consecutive.
Day 21: April 4, 2017*
- 25_BeautifulBinary.py: Given a binary string, you need to make it to a beautiful string. To be considered a beautiful, you cannot have
010
. You are allowed to switch the 0s and 1s to make it a beautiful string. Find the minimum steps it would take to do so.
Day 22: April 5, 2017*
Day 23: April 6, 2017*
Day 24: April 7, 2017*
Day --: April 8, 2017 --> April 9, 2017
Day 25: April 10, 2017*
Day --: April 12, 2017 --> April 17, 2017:
Working on Job Interviews and Coding ChallengesDay 28: April 19, 2017
- 32_BirthdayCakeCandles.py: Given an input of number of candles and an array of candles. Return the number of candles a child can blow if she can only blow the tallest ones.
Day 29: April 20, 2017
- 33_Inheritance.py: Given two class, Person and Student, Person is the base class and Student is the derived class. Student inherits all properties of Person. Return the char grade with a calculate method.
Day 31: April 22, 2017
- 35_BigSorting.py:Consider an array of numeric strings, unsorted , where each string is a positive number with anywhere from 1 to 10^6 digits. Sort the array's elements in non-decreasing (i.e., ascending) order of their real-world integer values and print each element of the sorted array on a new line.
Day 32: April 23, 2017
Day --: April 24, 2017 --> April 27, 2017
Day 33: April 28, 2017
- 37_bon-appetit.py: Given a list of ordered number, and an item that was not eaten. Calculate if the bill was seperated correctly. Detailed Prompt Here
Day --: April 29, 2017 --> May 7, 2017:
Working on prepartion of Finals, and Job Interviews + Coding ChallengesDay 34: May 8, 2017
- 38_Kangaroo.py: There are two kangaroos on an x-axis ready to jump in the positive direction (i.e, toward positive infinity). The first kangaroo starts at location
X1
and moves at a rate ofV1
meters per jump. The second kangaroo starts at locationX2
and moves at a rate ofV2
meters per jump. Given the starting locations and movement rates for each kangaroo, can you determine if they'll ever land at the same location at the same time?
Day --: May 9, 2017 --> May 11, 2017:
Finals at School.Day 35: May 12, 2017
- 39_InsertionSort1.py: Given
e
, the rightmost number in the list, insert it into the list. (1,2,4,3
-->1,2,3,4
)
Day 36: May 13, 2017
- 40_InsertionSort2.py: Adding on to previous Insertion sort, now sort an unsorted list. (
2,4,3,1
-->1,2,3,4
)
Day 38: May 15, 2017
Day 39: May 16, 2017
Day 48 - 51: May to June
Algorithms 52 - 55:
Day 54: January 1st, 2018
- 58_CountingSort2.py: Given an unsorted list of integers, output the integers in order.