about | help | code help+videos | done | prefs |
isSymmetric
Write a boolean method named isSymmetric whose parameter is a String that represents a rectangular two dimensional array of ints, representing a matrix. Convert it to a two dimensional array with method toArray(). isSymmetric will return false if any element doesn't match its opposite (reflected across the row=column line, otherwise true. It will also return false if the array isn't square. For example, {{1,2,3},{2,1,4},{3,4,1}} is symmetric. It may help to write these as square matrices to see the symmetry. The line of symmetry is all ones in this example. You must cut and paste method toArray() from the hint. isSymmetric("{{1,0},{0,1}}") → true isSymmetric("{{}}") → false isSymmetric("{{3}}") → true ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 350 Post-solution available
Copyright Nick Parlante 2017 - privacy