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

 

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

Create a method that takes an array of integers called 'nums'. This array will contain all the numbers from 1 to some maximum number in order, but excluding one number. The excluded number could be 1 or any ONE number in the middle. The excluded number will NOT be the last number. Return the missing number. For example, if 'nums' was {1,2,3,4,5,7,8,9,10} you would return 6 since that is the missing number. Look at the test data for other examples.


quiz2021_11_16_APSLHL_missing([1, 3]) → 2
quiz2021_11_16_APSLHL_missing([1, 2, 3, 4, 6, 7, 8, 9]) → 5
quiz2021_11_16_APSLHL_missing([1, 2, 3, 4, 6]) → 5

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

public int quiz2021_11_16_APSLHL_missing(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: 220

Copyright Nick Parlante 2017 - privacy