6 kyu
Cross the Bridges
79Jomopipi
Description:
This input is an object containing some number of cities.
For each city in the object there is a list.
The length of the list is the number of bridges in the city.
Each element in the list is the name of a city-- the destination.
We want to know if we can visit every city by taking every bridge exactly once.
It's okay to visit the same city more than once.
Return true if we can do it, otherwise false.
Examples
inputs | visual representations |
---|---|
input1 = { A : [B,C,D] B : [A] C : [A,D] D : [A,C] } output: true |
The circles are nodes (cities) and red lines are bridges. |
Tests:
- 900 random tests
- largest input may hold over 900 cities
Performance
Algorithms
Graph Theory
Similar Kata:
Stats:
Created | Sep 1, 2018 |
Published | Sep 1, 2018 |
Warriors Trained | 349 |
Total Skips | 4 |
Total Code Submissions | 1114 |
Total Times Completed | 79 |
JavaScript Completions | 79 |
Total Stars | 14 |
% of votes with a positive feedback rating | 93% of 30 |
Total "Very Satisfied" Votes | 27 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 5 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |