Tap here to switch tabs
Problem
Submissions

Problem: Sum of Elements With Frequency Divisible by K

Sum of Elements With Frequency Divisible by K asks you to find value frequencies in an integer array, then sum every occurrence of values whose frequency is divisible by k, or return zero if none qualify.

Statement

Given an integer array nums and an integer k, return the sum of all elements in nums whose frequency in nums is divisible by k.

If no elements satisfy this condition, return 00.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100

  • 1≤1 \leq k ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of Elements With Frequency Divisible by K

Sum of Elements With Frequency Divisible by K asks you to find value frequencies in an integer array, then sum every occurrence of values whose frequency is divisible by k, or return zero if none qualify.

Statement

Given an integer array nums and an integer k, return the sum of all elements in nums whose frequency in nums is divisible by k.

If no elements satisfy this condition, return 00.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100

  • 1≤1 \leq k ≤100\leq 100