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

 

linearIn


Given two arrays of ints sorted in increasing order, *a* and *b*, return true if all of the numbers in b appear in a. The best solution makes only a single "linear" pass of both arrays, taking advantage of the fact that both arrays are already in sorted order.


linearIn([1, 2, 4, 6], [2, 4]) → true
linearIn([1, 2, 4, 6], [2, 3, 4]) → false
linearIn([1, 2, 4, 4, 6], [2, 4]) → true

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

public boolean linearIn(int[] a, int[] b) { }

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

Copyright Nick Parlante 2017 - privacy