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

 

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

Yoda has a list of numbers. At most, two of the numbers in the list will match. The list will have less than 100 numbers in it. Return an integer representing the position in the list of the two matching numbers. The 1000's and 100's place will be the position in the list of the lower indexed number, except that each index will start at 1 instead of 0. The 10's and 1's place will be the position of the higher indexed number, again starting at 1 instead of 0. For example, in the list {3, 7, 3}, the matching numbers are in index 1 and index 3. 103 will be the value that gets returned. Suppose the matching numbers are at index 31 and index 50... in that case return 3150. Look at the test data for further examples. If no numbers match in the list, return -1.


yodaMatchNumsAdvanced1([4, 8, 3, 2, 4, 7, 12]) → 105
yodaMatchNumsAdvanced1([1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10]) → 708
yodaMatchNumsAdvanced1([5, 12, 22, 4, 3, 17, 53, 55, 83, 51, 2, 8, 99, 17]) → 614

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

public int yodaMatchNumsAdvanced1(int[] nums) { }

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

Copyright Nick Parlante 2017 - privacy