알고리즘/Array 3

Circular Array

23:59, 00:00 의 분 단위 차이는 1분이다. 이런 시간들이 여러개 있을 때 그 최소 차이를 구하는 문제이다. https://leetcode.com/problems/minimum-time-difference/ Minimum Time Difference - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 시계 바늘처럼 일정 값에 도달하면 다시 원점으로 돌아가는 자료는 circular array로 모델링 할 수 있다. 아래 코드를 직접 보자. # https:/..

알고리즘/Array 2022.05.29

비교

https://leetcode.com/problems/slowest-key/ Slowest Key - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 이런 문제를 보자. 정렬시 두 조건을 차례로 비교하는 문제이다. max도 결국 비교하는 함수이므로 sort와 마찬가지로 key= 를 줄 수 있게 되어 있음을 안다면 쉽게 해결할 수 있다. class Solution: def slowestKey(self, releaseTimes: List[int], keysPresse..

알고리즘/Array 2022.05.08

string methods

Python의 문자열(string) 관련 함수와 상수를 소개한다. ascii 코드에 속하는 문자, 소문자들, 숫자들, 16진수, 구두점 등을 조건으로 걸어 문자열 관련 처리를 할 경우에 프로그래머가 직접 이를 포함한 array를 만드는 불편함을 덜어주는 유용한 상수라고 할 수 있다. string 모듈 먼저 string 모듈(.py)은 유용한 상수를 많이 포함하고 있다. import string L = [ string.ascii_letters, string.ascii_lowercase, string.ascii_uppercase, string.digits, string.hexdigits, string.punctuation ] for l in L: print(l) ''' abcdefghijklmnopqrstu..

알고리즘/Array 2022.03.03