X441: Graphs - Create Matrix

May Tricks owns a chain of magic shops. She hands you a list of her store locations and asks you to find a way of quickly looking up the driving distance between any given location. You figure the best way to do this is to create an adjacency matrix.

Given is an array of vertices. Write a method to create an adjacency matrix for these with initial values of 0. We'll revisit this matrix in a later exercise to fill it out.

Examples:

createMatrix({"Downtown","Uptown","Middletown"}) -> {{0, 0, 0},{0, 0, 0},{0, 0, 0}}

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.