Premium problem64. Add 1 at Indexed Positions

Hard Locked

Given vector Z and an index vector I (which may contain repeats), add 1 to Z at each index in I for every time that index occurs (so an index repeated 3 times adds 3). Return the result.

Input

Z = [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
I = [1 1 2 3 3 3 9]

Output

[1. 3. 2. 4. 1. 1. 1. 1. 1. 2.]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)