Hackerrank – Connecting Towns

Problem Statement
A description of the problem can be found on Hackerrank.

Solution
Count of all routes as multiplication of routes between towns.

I created solution in:

All solutions are also available on my GitHub.

Java

JavaScript

Scala

Ruby