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

 

norm.krumpe@muohio.edu program11 > findSubArray
prev  |  next  |  chance

Does the first array appear as a sequence within the second array? If so, return the first index where the first array can be found within the second. Otherwise, return -1. We will say that an empty array can be found in any array beginning at index 0.


findSubArray([5, 12], [2, 7, 5, 12, 14]) → 2
findSubArray([9], [4, 9, 7, 9]) → 1
findSubArray([4, 8], [4, 7, 8, 9, 10, 8, 4]) → -1

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

int findSubArray(int[] sub, 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: 300

Copyright Nick Parlante 2017 - privacy