Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. def degreeOfArray(arr):
  2.     hmap = {}
  3.     currentMax = 0
  4.     for i in range(len(arr)):
  5.         if(arr[i] in hmap):
  6.             currentValues = hmap[arr[i]]
  7.             currentValues[0] = currentValues[0] + 1
  8.             currentValues[1] = i
  9.             hmap[arr[i]] = currentValues
  10.             if (currentValues[0] > currentMax):
  11.                
  12.         else:
  13.             hmap[arr[i]] = [1,i]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement