#3712

Sum of Elements With Frequency Divisible by K

newbie · 215 · lc easy +17 · 77.6% accepted · 54 likes · top 89%

Description

Given an integer array nums and an integer k, return the sum over all elements whose frequency in nums is divisible by k, counting each element as many times as it appears; return 0 if no element qualifies.

Code

1
2
3