Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
TopCoder SRM 673 Div 2
from collections import defaultdict
class BearSong():
def countRareNotes(self, notes):
d = defaultdict(int)
for i in notes:
d[i] += 1
return(len([i for i in d.values() if i == 1]))
class BearSlowlySorts():
def minMoves(self, w):
w = list(w)
if w == sorted(w):
return 0
else:
minw = min(w)
maxw = max(w)
if minw == w[0]:
return 1
elif maxw == w[-1]:
return 1
elif maxw == w[0]:
if minw == w[-1]:
return 3
else:
return 2
else:
return 2
Owner

whatalnk commented Nov 19, 2015

  • Easy
  • Med
  • Hard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment