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

 

jebbert@volusia.k12.fl.us > getMyDigit
prev  |  next  |  chance

Write a method that accepts a non-empty array of non-negative integers and an integer "pos" indicating the position of the desired digit. The method returns the digit that appears at position "pos" where all the integers in the array are listed in the order they are given. For example getMyDigit({45, 8206, 53, 71}, 5) returns a 0 because if you list all the integers in order like this: 4582065371, the 5th digit is a zero. Note that the first digit is digit number 1, not digit number 0.


getMyDigit([521, 842, 4001, 487, 12345, 81], 18) → 5
getMyDigit([1, 2, 3, 4, 5, 678, 91011, 121314], 16) → 1
getMyDigit([987, 654, 321, 123, 45678, 91011], 1) → 9

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

public int getMyDigit(int[] nums, int pos) { }

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: 330

Copyright Nick Parlante 2017 - privacy