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

 

indexOfPartial


Write a method, that returns the first index of the first location in the partially filled array that contains the specified key, or -1 if the key is not in the partially filled array. size will always be at least 0 and at most the length of the array. NOTE: In a "partially filled" array, the variable size indicates how many of the elements in that array (beginning at index 0) actually are "in use". For example, given the array {4, 7, 2, 5, 1, 4, 8} and a size of 3 then only the first 3 elements in that array (4, 7, and 2) are actually considered "in use".


indexOfPartial([4, 7, 2, 5, 1, 4, 8], 3, 5) → -1
indexOfPartial([4, 7, 2, 5, 1, 4, 8], 4, 5) → 3
indexOfPartial([2, 4, 6], 1, 2) → 0

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

int indexOfPartial(int[] nums, int size, int key) { }

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

Copyright Nick Parlante 2017 - privacy