Skip to content
the poor coder

Home / Topics / #algorithms

#Algorithms

191 posts · page 8 of 10
2020

Hackerrank - Strong Password Solution

Louise joined a social networking site to stay in touch with her friends. The signup page required her to input a name and a password. However, the password must be strong. The website considers a password to be strong…

2020

Hackerrank - Closest Numbers Solution

Sorting is useful as the first step in many different tasks. The most common task is to make finding things easier, but there are other uses as well. In this case, it will make it easier to determine which pair or pairs…

2020

Hackerrank - Happy Ladybugs Solution

Happy Ladybugs is a board game having the following properties: The board is represented by a string, , of length . The character of the string, , denotes the cell of the board. If is an underscore (i.e., _), it means…

2020

Hackerrank - Strange Counter Solution

Bob has a strange counter. At the first second, it displays the number . Each second, the number displayed by the counter decrements by until it reaches . The counter counts down in cycles. In next second, the timer…

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…

ESC