Skip to content
the poor coder

Home / Author

Poor Man

2,994 posts
2020

Hackerrank - Manasa and Stones Solution

Manasa is out on a hike with friends. She finds a trail of stones with numbers on them. She starts following the trail and notices that any two consecutive stones' numbers differ by one of two values. Legend has it that…

2020

Hackerrank - Find Digits Solution

An integer is a divisor of an integer if the remainder of . Given an integer, for each digit that makes up the integer determine whether it is a divisor. Count the number of divisors occurring within the integer. Note…

2020

Hackerrank - Flatland Space Stations

Flatland is a country with a number of cities, some of which have space stations. Cities are numbered consecutively and each has a road of length connecting it to the next city. It is not a circular route, so the first…

2020

Hackerrank - Repeated String Solution

Lilah has a string, , of lowercase English letters that she repeated infinitely many times. Given an integer, , find and print the number of letter a's in the first letters of Lilah's infinite string. For example, if…

2020

Hackerrank - Re.split() Solution

Check Tutorial tab to know how to to solve. You are given a string consisting only of digits 0-9, commas ,, and dots . Your task is to complete the regex_pattern defined below, which will be used to re.split() all of…

2020

Hackerrank - Utopian Tree Solution

The Utopian Tree goes through 2 cycles of growth every year. Each spring, it doubles in height. Each summer, its height increases by 1 meter. Laura plants a Utopian Tree sapling with a height of 1 meter at the onset of…

2020

Hackerrank - Validating UID Solution

ABCXYZ company has up to employees. The company decides to create a unique identification number (UID) for each of its employees. The company has assigned you the task of validating all the randomly generated UIDs. A…

2020

Hackerrank - Angry Professor Solution

A Discrete Mathematics professor has a class of students. Frustrated with their lack of discipline, he decides to cancel class if fewer than some number of students are present when class starts. Arrival times go from…

2020

Hackerrank - Picking Numbers Solution

Given an array of integers, find and print the maximum number of integers you can select from the array such that the absolute difference between any two of the chosen integers is less than or equal to . For example, if…

2020

Hackerrank - Bigger is Greater Solution

Lexicographical order is often known as alphabetical order when dealing with strings. A string is greater than another string if it comes later in a lexicographically sorted list. Given a word, create a new word by…

2020

Python - Halloween Sale Solution

You wish to buy video games from the famous online video game store Mist. Usually, all games are sold at the same price, p dollars. However, they are planning to have the seasonal Halloween Sale next month in which you…

2020

Hackerrank - Minimum Distances Solution

We define the distance between two array values as the number of indices between the two values. Given , find the minimum distance between any pair of equal elements in the array. If no such value exists, print . For…

2020

Hackerrank - Beautiful Pairs Solution

You are given two arrays, and , both containing integers. A pair of indices is beautiful if the element of array is equal to the element of array . In other words, pair is beautiful if and only if . A set containing…

2020

Hackerrank - Cats and a Mouse Solution

Two cats and a mouse are at various positions on a line. You will be given their starting positions. Your task is to determine which cat will reach the mouse first, assuming the mouse doesn't move and the cats travel at…

2020

Hackerrank - Electronics Shop Solution

Monica wants to buy a keyboard and a USB drive from her favorite electronics store. The store has several models of each. Monica wants to spend as much as possible for the items, given her budget. Given the price lists…

2020

Hackerrank - Cut the sticks Solution

You are given a number of sticks of varying lengths. You will iteratively cut the sticks into smaller sticks, discarding the shortest pieces until there are none left. At each iteration you will determine the length of…

2020

Hackerrank - Library Fine Solution

Your local library needs your help! Given the expected and actual return dates for a library book, create a program that calculates the fine (if any). The fee structure is as follows: If the book is returned on or…

2020

Hackerrank - Drawing Book Solution

Brie’s Drawing teacher asks her class to open their books to a page number. Brie can either start turning pages from the front of the book or from the back of the book. She always turns pages one at a time. When she…

ESC