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

 

jebbert@volusia.k12.fl.us > test2022_11_03_SLHL_countMatches
prev  |  next  |  chance

Write a method that accepts two input parameters 'nums1' and 'nums2'. Count the number of times that one of the corresponding elements in one of the arrays is a factor of the corresponding element in the other array. As preconditions you may assume that the arrays are the same length and that they only contain integers greater than 1. For example, if the arrays were: {12,15,77} and {4,45,54} you would return 2 because 4 is a factor of 12 and 15 is a factor of 45, so they would both count, but 54 is not a factor of 77 so it does not count. Note: For this problem, we will NOT consider a number to be its own factor, so 14 is NOT a factor of 14! Look at the test data for additional examples.


test2022_11_03_SLHL_countMatches([24], [12]) → 1
test2022_11_03_SLHL_countMatches([72, 3], [17, 5]) → 0
test2022_11_03_SLHL_countMatches([16, 15, 23, 100, 45], [8, 30, 92, 5, 5]) → 5

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

public int test2022_11_03_SLHL_countMatches(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: 250

Copyright Nick Parlante 2017 - privacy