Skip to content
the poor coder

Home / Author

Poor Man

2,994 posts
2020

Hackerrank - Sock Merchant Solution

John works at a clothing store. He has a large pile of socks that he must pair by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors…

2020

Hackerrank - Bon Appétit Solution

Anna and Brian are sharing a meal at a restaurant and they agree to split the bill equally. Brian wants to order something that Anna is allergic to though, and they agree that Anna won't pay for that item. Brian gets…

2020

Hackerrank - Migratory Birds Solution

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…

2020

Hackerrank - Birthday Chocolate Solution

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…

2020

Hackerrank - Grading Students Solution

HackerLand University has the following grading policy: Every student receives a in the inclusive range from to . Any less than is a failing grade. Sam is a professor at the university and likes to round each student's…

2020

Hackerrank - Sequence Equation Solution

Given a sequence of integers, where each element is distinct and satisfies . For each where , find any integer such that and print the value of on a new line. For example, assume the sequence . Each value of between and…

2020

Hackerrank - Append and Delete Solution

You have a string of lowercase English alphabetic letters. You can perform two types of operations on the string: Append a lowercase English alphabetic letter to the end of the string. Delete the last character in the…

2020

Hackerank - Save the Prisoner! Solution

A jail has a number of prisoners and a number of treats to pass out to them. Their jailer decides the fairest way to divide the treats is to seat the prisoners around a circular table in sequentially numbered chairs. A…

2020

Extra Long Factorials Solution

The factorial of the integer n, written n!, is defined as: Calculate and print the factorial of a given integer. For example, if , we calculate and get . Function Description Complete the extraLongFactorials function in…

Hackerrank1 min read
2020

Hackerrank - Between Two Sets Solution

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…

2020

Insertion Sort - Part 2 Solution

In Insertion Sort Part 1, you inserted one element into an array at its correct sorted position. Using the same approach repeatedly, can you sort an entire array? Guideline: You already can place an element into a…

Hackerrank2 min read
2020

Insertion Sort - Part 1 Solution

Sorting One common task for computers is to sort data. For example, people might want to see all their files on a computer sorted by size. Since sorting is a simple problem with many different possible solutions, it is…

Hackerrank2 min read
2020

Hackerrank - Encryption Solution

An English text needs to be encrypted using the following encryption scheme. First, the spaces are removed from the text. Let be the length of this text. Then, characters are written into a grid, whose rows and columns…

2020

Hackerrank - Kangaroo Solution

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…

ESC