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

 

countModPairs


Find all elements in the array such that a mod b = 0, where a appears earlier in the array than b. Return the count of such pairs. Pairs do not need to be consecutive.


countModPairs([6, 3]) → 1
countModPairs([6, 7, 3]) → 1
countModPairs([2, 10, 8, 5, 4]) → 2

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

public int countModPairs(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