Degree Of An Array Leetcode Solution