Added solution of Array Question #21
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The State Of Wakanda.
The historic state of Wakanda has various monuments and souvenirs which are visited by many travelers every day. The guides follow a prescribed route of visiting the monuments which improves their understanding of the relevance of each monument.
The route of the monument is fixed and expressed in a 2-d matrix where the travelers visit the prescribed next monument. For example
1 2 3
4 5 6
7 8 9
is the prescribed route and the visitors travels this path: 1->2->3->4->5->6->7->8->9
However, a certain visitor decides to travel a different path as follows:
This continues till all the places are covered.
For example, the monuments are named as follows:
1 2 3
4 5 6
7 8 9
Path followed by traveler: 1->4->7->8->5->2->3->6->9
You are required to print the path that this traveler follows to visit all places.
Note - Please check the output format for details.