Dodomeki
Sign in

3. Count Frequencies

Easy

Given an array of integers, return an object that maps each number to the number of times it appears. The keys should be the numbers converted to text.

Example 1
Input: nums = [4,2,4,-1,2,4]
Output: {"2":2,"4":3,"-1":1}
Example 2
Input: nums = [7,7,7]
Output: {"7":3}
Constraints
  • 0 <= nums.length <= 10000
  • -100000 <= nums[i] <= 100000
ArraysHash map
Caso 1
nums =
[4,2,4,-1,2,4]
Expected =
{"2":2,"4":3,"-1":1}
Caso 2
nums =
[7,7,7]
Expected =
{"7":3}

Run checks these 2 cases. Submit runs all 6, including hidden ones.