Looking for good programming challenges?

Use the search below to find our solutions for selected questions!

Archive for December 2016

Add two numbers challenge

Problem statement You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. Sample Input

Sample Output

Solution/Code

Radio transmitters challenge

Problem statement Hackerland is a one-dimensional city with houses, where each house is located at some on the x-axis. The Mayor wants to install radio transmitters on the roofs of the city’s houses. Each transmitter has a range, , meaning it can transmit a signal to all houses units of . . . Read more

Chain names challenge

Problem statement You’re given an array of names, where each name is given as a string. Your task is to link these names into a chain, so that the name starts with the same letter the name ends, and return this chain as a list. All names should be used. . . . Read more

Twins challenge

Problem statement Lia is fascinated by anything she considers to be a twin. She calls a pairs of positive integers, and , twins if: – They are both prime. A prime number is an integer greater than that has no positive divisors other than and itself. – Their absolute difference . . . Read more

Group anagrams challenge

Problem statement An anagram is a word that can be written as a permutation of the characters of another word, like “dirty room” and “dormitory” (ignore spaces). However, “the” and “thee” are not anagrams, since “the” only has a single “e” whereas “thee” has two “e” characters (spaces can occur . . . Read more

Absolute element sums challenge

Problem statement Given an array, , of integers, you must answer queries. Each query consists of a single integer, , and is performed as follows: Add to each element of the array, permanently modifying it for any future queries. Find the absolute value of each element in the array and . . . Read more

Balanced parenthesis challenge

Problem statement Create function that will determine if the parenthesis are balanced in a given string . Sample Input 1

Sample Output 1

Sample Input 2

Sample Output 2

Solution We will iterate over the string’s characters and hold three counters: openParentheses, openSquare and openCurly that . . . Read more

Roads and libraries challenge

The Ruler of HackerLand believes that every citizen of the country should have access to a library. Ufortunately, HackerLand was hit by a tornado that destroyed all of its libraries and obstructed its roads! As you are the greatest programmer of HackerLand, the ruler wants your help to repair the . . . Read more

Climbing the leaderboard challenge

Problem statement Alice is playing an arcade game and wants to climb to the top of the leaderboard. Can you help her track her ranking as she beats each level? The game uses Dense Ranking, so its leaderboard works like this: The player with the highest score is ranked number . . . Read more