id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

simona1@sfusd.edu two_d_arrays > reverseCols
prev  |  next  |  chance

Write a method named reverseCols that returns a string representation of a two-dimensional array of int. The 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(). The resultant array should have the elements of each column reversed, first to last. For example, {{1,2},{3,4},{5,6}} returns {{5,6},{3,4},{1,2}}. Build the array in this method, then use toString() to return the array as a string. You must cut and paste methods toString() and toArray() from the Hint.


reverseCols("{{}}") → "{{},{}}"
reverseCols("{{3}}") → "{{3}}"
reverseCols("{{2},{5},{8},{12},{15}}") → "{{15},{12},{8},{5},{2}}"

...Save, Compile, Run (ctrl-enter)

public String reverseCols(String s) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 345 Post-solution available

Copyright Nick Parlante 2017 - privacy