CHIqueen
[Intro] areEquallyStrong
def areEquallyStrong(yourLeft, yourRight, friendsLeft, friendsRight): return (yourLeft == friendsLeft or yourLeft == friendsRight) and (yourRight == friendsLeft or yourRight == friendsRight) 굉장히 쓰잘떼기 없어보이지만 통과다 return {yourLeft, yourRight} == {friendsLeft, friendsRight} 파이썬의 set을 잘 사용한 예시
프로그래밍/CodeSignal
2020. 3. 17. 16:45
[Intro] palindromeRearranging
def palindromeRearranging(inputString): return sum([inputString.count(i)%2 for i in set(inputString)])
프로그래밍/CodeSignal
2020. 3. 17. 16:39
[Intro] Are Similar?
Two arrays are called similar if one can be obtained from another by swapping at most one pair of elements in one of the arrays. Given two arrays a and b, check whether they are similar. def areSimilar(a, b): return sorted(a)==sorted(b) and sum([c!=d for c,d in zip(a,b)])
프로그래밍/CodeSignal
2020. 3. 17. 16:05