Introduction
Summary
17. Question 3

Instruction

Alright, moving on to the third question.

Exercise

Remember when Mark checked all the capitals that are within 500 kilometers of the New York? Well, Mark wants to know for sure whether there is a capital that would be more suitable to start one of his greatest trips.

For each state, show its name, its capital and the number of other capitals that are within 500 kilometers of its capital. Sort the results in descending order by the number of capitals within 500 kilometers and then by state names in ascending order.

Do not show states whose capitals don't have any neighboring capitals within 500 kilometers.

Console

Code editor

Result

TableConsole