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

 

norm.krumpe@muohio.edu arrays > countOccurrences
prev  |  next  |  chance

Given two arrays of integers, how many of the elements in the first array are contained in the second array? The first array will always contain at least one value.


countOccurrences([4, 5, 6], [7, 4, 9]) → 1
countOccurrences([4, 5, 6], [4, 6, 5, 4, 6, 5]) → 3
countOccurrences([4, 6, 5, 4, 6, 5], [4, 5, 6]) → 6

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

int countOccurrences(int[] nums1, int[] nums2) { }

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