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

 

gaurav.gupta@mq.edu.au arraylists > index2D
prev  |  next  |  chance

Define a function that when passed a 2-dimensional ArrayList of Integers, and another int value, returns the index of the first sub-list in which the value exists, -1 if it doesn't in any of the sub-lists.


index2D([[10, 70], [20, 90]], 20) → 1
index2D([[10, 70], [20, 90]], 70) → 0
index2D([[10, 70], [20, 90]], 50) → -1

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

int index2D(ArrayList<ArrayList<Integer>> list, int item) { }

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

Copyright Nick Parlante 2017 - privacy