Premium problem31. Most Frequent Value

Medium Locked

Return the most frequent (mode) value in the non-negative integer tensor Z. If multiple values are tied for most frequent, return the smallest one.

Input

tensor([1, 2, 2, 3, 3, 3, 4])

Output

3

Premium problem

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

Implement solve(...)