backend
TIL 문제풀이
seul chan
2018. 6. 5. 23:59
18-05-31
# my answer
commit = "0??+0+!!someCommIdhsSt"
def getCommit(commit):
return ''.join([x for x in list(commit) if x.isalpha()])
# best answer
def getCommit(commit):
return commit.lstrip('0?+!')
18-06-05
lambda
repeatChar = lambda ch, n: ch * n
def getPoints(answers, p):
questionPoints = lambda i, ans: i+1 if ans else -p
res = 0
for i, ans in enumerate(answers):
res += questionPoints(i, ans)
return res
def sortStudents(students):
students.sort(key= lambda s: s.split()[-1] )
return students
def isTestSolvable(ids, k):
digitSum = lambda x: sum(map(int, str(x)))
sm = 0
for questionId in ids:
sm += digitSum(questionId)
return sm % k == 0