Skip to content

SL TECH ACADEMY

Contact us
  • Home
  • C++
  • Pyhton
  • Java
  • Networking
  • Problem Solving
    • Algorithms
    • Data Structures
  • Contests
    • IOI
    • APIO
    • Google
      • Code Jam
      • Hash Code
      • Kick Start
  • Resources

SL TECH ACADEMY

Category: Algorithms

  • Algorithms

Day of the Programmer – HackerRank Solution

imageByPasindu Piumal2020-09-11
Day of the Programmer – HackerRank Solution
Problem : Marie invented a Time Machine and wants to test it by time-traveling to visit Russia on the Day of the Programmer (the 256th day of the year) during a year in the inclusive range from 1700 to 2700. From 1700 to 1917, Russia’s official calendar was the Julian

Read More

  • Algorithms

Migratory Birds – HackerRank Solution

imageByPasindu Piumal2020-09-03
Migratory Birds – HackerRank Solution
Problem : You have been asked to help study the population of birds migrating across the continent. Each type of bird you are interested in will be identified by an integer value. Each time a particular kind of bird is spotted, its id number will be added to your array of

Read More

  • Algorithms

Divisible Sum Pairs – HackerRank Solution

imageByPasindu Piumal2020-09-03
Divisible Sum Pairs – HackerRank Solution
Problem : You are given an array of n integers, ar = [ar[0], ar[1], ..., ar[n-1]], and a positive integer, k. Find and print the number of (i, j) pairs where i < j and ar[i] + ar[j] is divisible by k. For example, ar = [1, 2, 3, 4, 5, 6] and k = 5. Our three pairs meeting

Read More

  • Algorithms

Birthday Chocolate – HackerRank Solution

imageByPasindu Piumal2020-09-01
Birthday Chocolate – HackerRank Solution
Problem : Lily has a chocolate bar that she wants to share it with Ron for his birthday. Each of the squares has an integer on it. She decides to share a contiguous segment of the bar selected such that the length of the segment matches Ron’s birth month and the sum of

Read More

  • Algorithms

Breaking the Records – HackerRank Solutions

imageByPasindu Piumal2020-08-31
Breaking the Records – HackerRank Solutions
Problem : Maria plays college basketball and wants to go pro. Each season she maintains a record of her play. She tabulates the number of times she breaks her season record for most points and least points in a game. Points scored in the first game

Read More

  • Algorithms

Between Two Sets – HackerRank Solution

imageByPasindu Piumal2020-08-25
Between Two Sets – HackerRank Solution
Problem : You will be given two arrays of integers and asked to determine all integers that satisfy the following two conditions: The elements of the first array are all factors of the integer being considered The integer being considered is a factor of all elements of the

Read More

  • Algorithms

Kangaroo – HackerRank Solution

imageByPasindu Piumal2020-08-21
Kangaroo – HackerRank Solution
Problem : You are choreographing a circus show with various animals. For one act, you are given two kangaroos on a number line ready to jump in the positive direction (i.e, toward positive infinity). The first kangaroo starts at location x1 and moves at a rate of v1 meters

Read More

  • Algorithms

Apple and Orange – HackerRank Solution

imageByPasindu Piumal2020-08-21
Apple and Orange – HackerRank Solution
Problem : Sam’s house has an apple tree and an orange tree that yield an abundance of fruit. In the diagram below, the red region denotes his house, where s is the start point, and t is the endpoint. The apple tree is to the left of his house, and the orange tree is to

Read More

  • Algorithms

Grading Students – HackerRank Solution

imageByPasindu Piumal2020-08-21
Grading Students – HackerRank Solution
Problem : HackerLand University has the following grading policy: Every student receives a grade in the inclusive range from 1 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

Read More

  • Algorithms

Time Conversion – HackerRank Solution

imageByPasindu Piumal2020-08-21
Time Conversion – HackerRank Solution
Problem : Given a time in 12-hour AM/PM format, convert it to military (24-hour) time. Note: Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock. Function Description : Complete

Read More

  • Algorithms

Birthday Cake Candles – HackerRank Solution

imageByPasindu Piumal2020-08-20
Birthday Cake Candles – HackerRank Solution
Problem : You are in charge of the cake for your niece’s birthday and have decided the cake will have one candle for each year of her total age. When she blows out the candles, she’ll only be able to blow out the tallest ones. Your task is to find out how many candles

Read More

  • Algorithms

Mini-Max Sum – HackerRank Solution

imageByPasindu Piumal2020-08-11
Mini-Max Sum – HackerRank Solution
Problem : Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers. Example : arr = [1, 3,

Read More

  • Algorithms

Staircase – HackerRank Solution

imageByPasindu Piumal2020-08-11
Staircase – HackerRank Solution
Problem : Consider a staircase of size n = 4: 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. Write a program that prints a staircase of

Read More

  • Algorithms

Plus Minus – HackerRank Solution

imageByPasindu Piumal2020-08-06
Plus Minus – HackerRank Solution
Problem : Given an array of integers, calculate the ratios of its elements that are positive, negative, and zero. Print the decimal value of each fraction on a new line with 6 places after the decimal. Note: This challenge introduces precision

Read More

  • Algorithms

Diagonal Difference – HackerRank Solution

imageByPasindu Piumal2020-08-06
Diagonal Difference – HackerRank Solution
Problem : Given a square matrix, calculate the absolute difference between the sums of its diagonals. For example, the square matrix arr is shown below: The left-to-right diagonal = 1 + 5 + 9 = 15. The right to left diagonal = 3 + 5 + 9 = 15. Their

Read More

  • Algorithms

A Very Big Sum -HackerRank Solution

imageByPasindu Piumal2020-08-06
A Very Big Sum -HackerRank Solution
Problem : In this challenge, you are required to calculate and print the sum of the elements in an array, keeping in mind that some of those integers may be quite large. Function Description : Complete the aVeryBigSum function in the editor below. It must return

Read More

  • Algorithms

Compare the Triplets – HackerRank Solution

imageByPasindu Piumal2020-07-31
Compare the Triplets – HackerRank Solution
Problem : Alice and Bob each created one problem for HackerRank. A reviewer rates the two challenges, awarding points on a scale from 1 to 100 for three categories: problem clarity, originality, and difficulty. The rating for Alice’s

Read More

  • Algorithms

Simple Array Sum – HackerRank Solution

imageByPasindu Piumal2020-07-28
Simple Array Sum – HackerRank Solution
Problem : Given an array of integers, find the sum of its elements. For example, if the array ar = [1, 2, 3], 1 + 2 + 3 = 6, so return 6. Function Description : Complete the simpleArraySum function in the editor below. It must return the sum of the array

Read More

  • Algorithms

Solve Me First – HackerRank Solution

imageByPasindu Piumal2020-07-27
Solve Me First – HackerRank Solution
Problem : Complete the function solveMeFirst to compute the sum of two integers. Function prototype : int solveMeFirst(int a, int b); where, a is the first integer input. b is the second integer input Return values : sum of the above two integers Sample Input :

Read More

Last Posts

Chef and Meetings – Codechef Solution – February Challenge 2021 Division 3

2021-02-08

Codeforces Round 697 – Ball in Berland Solution

2021-01-27

Codeforces Round 697 – New Year’s Number Solution

2021-01-27

Codeforces Round 697 – Odd Divisor Solution

2021-01-27
IOI 2020

IOI 2020 – Contest Day 1- Tickets Problem and Solution

2020-09-24

Archives

  • February 2021 (1)
  • January 2021 (3)
  • September 2020 (10)
  • August 2020 (68)
  • July 2020 (18)
Created by SL TECH ACADEMY. Powered by WordPress
Logo
  • Home
  • C++
  • Pyhton
  • Java
  • Networking
  • Problem Solving
    • Algorithms
    • Data Structures
  • Contests
    • IOI
    • APIO
    • Google
      • Code Jam
      • Hash Code
      • Kick Start
  • Resources