Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def degreeOfArray(arr):
- hmap = {}
- currentMax = 0
- for i in range(len(arr)):
- if(arr[i] in hmap):
- currentValues = hmap[arr[i]]
- currentValues[0] = currentValues[0] + 1
- currentValues[1] = i
- hmap[arr[i]] = currentValues
- if (currentValues[0] > currentMax):
- else:
- hmap[arr[i]] = [1,i]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement