X491: Graphs - Remove Vertex 2 (Adjacency Matrix)

Since May Tricks has proved to be a very unpredictable client you have decided to take extra precautions. By creating a remove vertex method editing the matrix will be less work should any stores suddenly disappear again.

This method will take in a matrix and the index of the vertex to be removed. It will return this new matrix with the remaining contents. The new matrix will be smaller.

Ex -> 3x3 will be come 2x2, 4x4 will become 3x3

Examples:

createMatrix({{3, 5, 0},{2, 1, 1},{9, 0, 0}},0) -> {{1, 1}, {0, 0}}
createMatrix({{3, 5, 0},{2, 1, 1},{9, 0, 0}},1) -> {{3, 0}, {9, 0}}
createMatrix({{3, 5, 0},{2, 1, 1},{9, 0, 0}},2) -> {{3, 5}, {2, 1}}

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.