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

 

generate2D


Given two integers (say n and p), return a homogenous ArrayList of ArrayList of Integer objects such that it holds n ArrayLists, each containing p zeroes.


generate2D(2, 3) → [[0, 0, 0], [0, 0, 0]]
generate2D(3, 2) → [[0, 0], [0, 0], [0, 0]]
generate2D(1, 5) → [[0, 0, 0, 0, 0]]

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

ArrayList<ArrayList<Integer>> generate2D(int n, int p) { }

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: 5 Post-solution available

Copyright Nick Parlante 2017 - privacy