목록전체 글 (280)
susinlee 님의 블로그
[문제]https://leetcode.com/problems/find-followers-count/description/ [풀이]1. user_id 별로 그룹화 후 follower_id 수를 센다2. user_id 로 오름차순 정렬해준다 Pandasimport pandas as pddef count_followers(followers: pd.DataFrame) -> pd.DataFrame: return followers.groupby('user_id').size().reset_index(name='followers_count').sort_values('user_id') SQLSELECT user_id , COUNT(follower_id) as followers_countFRO..

꼬리잘린 냉동새우를 사왔다 감바스를 해보자올리브유에 마늘을 좀 튀기다가 색 올라오면새우랑 페페론치노 투하물 좀 붓고 끓이다가 마무리될 쯤 버터랑 후추 소금(간장or스톡류) 투하생각보다 맛있네;
[문제]https://school.programmers.co.kr/learn/courses/30/lessons/76502 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr [풀이]1. stack 자료구조를 이용하여 괄호 검사를 진행한다2. 괄호 검사가 끝났다면 deque 자료구조를 이용해서 왼쪽으로 회전시켜준다 3. 문자열 길이만큼 반복한다 from collections import dequedef solution(s): answer = 0 n = len(s) queue = deque(s) # 문자열 길이만큼 반복 for _ in range(n): # 괄호 검사 ..
[문제]https://leetcode.com/problems/classes-more-than-5-students/ [풀이]1. class로 그룹화 해준 뒤 student의 수를 세어준다2. student 수가 5이상 행들만 필터링하고 class열만 출력한다 Pandasimport pandas as pddef find_classes(courses: pd.DataFrame) -> pd.DataFrame: df = courses.groupby('class')['student'].count().reset_index(name='cnt') return df[df['cnt'] >= 5][['class']] SQLSELECT classFROM CoursesGROUP BY classHAVING COUNT(st..

6시간 40분정도 잔거같다.. 죽겠다 오늘은 꼭 7시간 30분이상 잘 수 있도록 하자 갑자기 추워졌다.. 아침 노을.. 오늘은 등운동을 했다. 렛풀다운이랑 그 앞뒤로 땡기는 운동..- 렛풀다운 25kg 12개 3세트- 롱풀머신 25kg 15개 3세트 졸립다. 이따 낮잠 자야지
[문제]https://school.programmers.co.kr/learn/courses/30/lessons/138476 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr [풀이]1. 각 사이즈별 개수를 세준다 (Counter 사용)2. 값만 가져와서 내림차순으로 정렬해준 뒤3. 하나씩 더해가며 k가 넘어 갈 때 반복한 수를 리턴한다. from collections import Counterdef solution(k, tangerine): answer = 0 size = Counter(tangerine) size = sorted(size.values(), reverse=True) ..
7시 40분부터 8시 20분까지 헬스장 다녀옴 운동 전후로 스트레칭 해주고 본운동은 아래와 같다. - 벤치프레스 20kg 5개씩 3세트 - 인클라인 벤치프레스 5kg 8개씩 3세트- 맨몸 스쿼트 30개 가볍게 진행했는데 운동을 하니까 확실히 머리가 맑아지는 느낌이다.매일매일 하려고 노력해보자.
[문제]https://leetcode.com/problems/product-sales-analysis-iii/description/ [풀이]1. product_id 별로 연도가 가장 작은 행을 집계하고2. 기존 테이블과 product_id와 year를 키로 병합3. 병합한 테이블에서 제출 형식에 맞게 열을 선택하고 이름을 바꿔준다 Pandasimport pandas as pddef sales_analysis(sales: pd.DataFrame, product: pd.DataFrame) -> pd.DataFrame: t1 = sales.groupby('product_id')['year'].min().reset_index(name='year') merged = t1.merge(sales, on=[..