목록전체 글 (37)
개발부터 자유까지
DescriptionYou are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the following restrictions: After you sell your stock, you cannot buy stock on the next day (i.e., cooldown one day). Note: You may not ..
1. 피보나치 수열을 재귀 함수로 구현import sysimport timedef fibo_recur(x): if x 2. 피보나치 수열을 재귀 함수와 메모이제이션 기법 추가(Top-Down)import sysimport timesys.setrecursionlimit(10**8)dp = [0] * 41def fibo_memo(x): if dp[x] != 0: return dp[x] if x 3. 피보나치 수열을 반복문으로 구현(Bottom-Up)import sysimport timesys.setrecursionlimit(10**8)def fibo_iter(x): dp[0], dp[1] = 0, 1 for i in range(2, x+1): dp[..
DescriptionGiven an m x n matrix board where each cell is a battleship 'X' or empty '.', return the number of the battleships on board. Battleships can only be placed horizontally or vertically on board. In other words, they can only be made of the shape 1 x k (1 row, k columns) or k x 1 (k rows, 1 column), where k can be of any size. At least one horizontal or vertical cell separates between tw..
uv 설치방법linux 환경# Linux/macOS curl 명령어curl -LsSf https://astral.sh/uv/install.sh | sh# Linux/macOS uv 특정 버전 설치curl -LsSf https://astral.sh/uv/0.8.22/install.sh | sh# Linux/macOS wget 명령어wget -qO- https://astral.sh/uv/install.sh | sh windows 환경# Windows uv 최신 버전 설치powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"# Windows uv 특정 버전 설치powershell -ExecutionPolicy ByPa..
Redis는 dictionary 기반의 인메모리 오픈소스 데이터베이스다. 이 글에서 주로 설명하는 것은 파이썬 기반의 redis-py client 모듈을 설치해서 redis 사용방법을 알아볼 것이다. 먼저 아래 링크에서 Redis 서버를 설치가 전제되어 있어야 한다. Redis 데이터베이스 서버 설치각 운영 환경마다 설치하는 명령어는 아래 링크를 참고하면 된다. 1. 도커에 설치https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/docker/ 2. 리눅스 OShttps://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/apt/ 3. 맥 OShttps://r..
목차: 파이썬으로 이해하는 I/O 모델 (Sync, Async, Blocking, Non-blocking) 1. 시작하며: 개발자에게 I/O 모델이 왜 중요한가1-1. 문제의 발견: 느린 I/O 작업1-2. 핵심 비유: "유능한 셰프(CPU)와 게으른 웨이터(I/O)"2. 관점의 분리: I/O를 이해하는 두 가지 축2-1. 결과 처리의 관점: Sync vs Async2-2. 제어권의 관점: Blocking vs Non-blocking 1. 시작하며: 개발자에게 I/O 모델이 왜 중요한가? 1-1. 문제의 발견: 느린 I/O 작업잘못된 예- 웹 요청, DB 조회, 파일 읽기 등 I/O 작업이 프로그램 전체를 멈추게 하는 현상- Python 코드로 보는 문제 상황: requests와 for문을 이용한 순차적..
목차유니코드와 문자열ord 함수chr 함수중제목3 유니코드와 문자열유니코드가 나오기 전에 아스키 코드가 있었다. 아스키 코드는 영문자를 대상으로 문자를 숫자로 맵핑하기 위한 체계이다.총 128개의 문자를 7bit로 표현하고 1bit는 통신 에러 검출을 위해 사용하기 때문에 총 8bit로 표현한다. 아스키 코드 (ASCII) - American Standard Code for Information Interchange 범위: 아스키 코드는 7비트로 표현되어 총 128개의 문자를 담을 수 있습니다 (0~127까지의 정수값).지원문자: 아스키 코드는 주로 영문 알파벳, 숫자, 일부 특수 문자 및 제어 문자를 포함합니다.사용: 초기 컴퓨터 시스템에서 널리 사용되었으며, 영어를 사용하는 텍스트를 처리하는 데 적합..
1422. Maximum Score After Splitting a String Given a string s of zeros and ones, return the maximum score after splitting the string into two non-empty substrings (i.e. left substring and right substring).The score after splitting a string is the number of zeros in the left substring plus the number of ones in the right substring. Example 1:Input: s = "011101"Output: 5 Explanation: All possible ..