← Practice
Algorithms·medium 18 min 75 XP

Frequency Counter Pattern

Using the frequency counter pattern (not nested loops), return true if two arrays contain the same values with the same frequency, regardless of order.

Examples

  • sameFrequency([1,2,3], [3,2,1]) → true

Constraints

  • Keep the required function name so the tests can find it
  • Return a value instead of only logging it
  • Do not mutate inputs unless the challenge asks you to
Frequency Counter Pattern · editor

Code runs in an isolated Web Worker with a 3-second timeout — no DOM access, and it can never hang the page.