Given an array A[] of N positive integers which can contain integers from 1 to P where elements can be repeated or absent, count the frequency of all elements from 1 to N.
Note: Elements greater than N can be ignored, and you should modify the array in-place.
Input: N = 5, arr = [2,3,2,3,5], P = 5
Output: [0,2,2,0,1]
Explanation: 1 occurs 0 times, 2 occurs 2 times, 3 occurs 2 times, 4 occurs 0 times, 5 occurs 1 time.
Input: N = 4, arr = [3,3,3,3], P = 3
Output: [0,0,4,0]
Explanation: 1 occurs 0 times, 2 occurs 0 times, 3 occurs 4 times, 4 occurs 0 times.
Input: N = 6, arr = [1,4,4,6,6,6], P = 6
Output: [1,0,0,2,0,3]
Explanation: 1 occurs 1 time, 2 occurs 0 times, 3 occurs 0 times, 4 occurs 2 times, 5 occurs 0 times, 6 occurs 3 times.