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

 

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

Write a method named reverseRows 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 row reversed, first to last. For example, {{1,2,3},{4,5,6}} returns {{3,2,1},{6,5,4}}. 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.


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

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

public String reverseRows(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: 340 Post-solution available

Copyright Nick Parlante 2017 - privacy