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

 

containsPartial


Write a method, contains, that returns true if the partially filled array (see note) contains the specified key somewhere within the part of the data that is in use. 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".


containsPartial([4, 7, 2, 5, 1, 4, 8], 3, 5) → false
containsPartial([4, 7, 2, 5, 1, 4, 8], 4, 5) → true
containsPartial([2, 4, 6], 1, 2) → true

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

boolean containsPartial(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