### Looking for good programming challenges?

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

# Archive for December 2016

### Network flow problem: Maximize total amount of flow from s to t

Problem statement Find the maximum flow in a flow network (directed graph) from a source node to a target node subject to two constraints: – The flow on edge doesn’t exceed its capacity – For every node , the incoming flow is equal to outgoing flow. Consider the graph below. . . . Read more

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

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