목록전체 글 (280)
susinlee 님의 블로그
오늘은 자료구조에서 스택을 배웠고, 알고리즘에서는 이진 탐색에 대해 배웠다. 빨리 얘네 둘을 마무리하고 데이터 분석에 집중하고 싶다. 마무리 한 뒤에는 코딩 문제 하루 한 두 문제 푸는 걸로도 충분하지 않을까 싶다. 주말동안에 파이썬 과제하고, 로지컬씽킹 책 완독을 목표로 달려보자.
https://school.programmers.co.kr/learn/courses/30/lessons/155652 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr [문제]두 문자열 s와 skip, 그리고 자연수 index가 주어질 때, 다음 규칙에 따라 문자열을 만들려 합니다. 암호의 규칙은 다음과 같습니다.문자열 s의 각 알파벳을 index만큼 뒤의 알파벳으로 바꿔줍니다.index만큼의 뒤의 알파벳이 z를 넘어갈 경우 다시 a로 돌아갑니다.skip에 있는 알파벳은 제외하고 건너뜁니다.예를 들어 s = "aukks", skip = "wbqd", index = 5일 때, a에서 5만큼 뒤에 있는 알파벳은..
https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions/description/[문제]Write a solution to find the IDs of the users who visited without making any transactions and the number of times they made these types of visits.Return the result table sorted in any order.The result format is in the following example. [풀이] Pandasimport pandas as pddef find_customers(visits: pd...
[문제] https://leetcode.com/problems/product-sales-analysis-i/description/Write a solution to report the product_name, year, and price for each sale_id in the Sales table.Return the resulting table in any order.The result format is in the following example. [풀이]Pandasimport pandas as pddef sales_analysis(sales: pd.DataFrame, product: pd.DataFrame) -> pd.DataFrame: df = pd.merge(sales, product, ..
오늘은 선긋기와 카드점수라는 코딩 문제에 대해서 정리해보려고 한다. [선긋기]한 번의 선긋기는 수직선상의 한 점에서 다른 한 점까지 선을 긋는 것입니다. 선을 그을 때는 이미 선이 있는 위치에 겹쳐서 그을 수도 있습니다. 여러번 그은 곳과 한 번 그은 곳의 차이는 없습니다. 수직선은 0번 지점부터 m번 지점까지의 길이를 갖고 있습니다. 매개변수 nums에 각각의 선긋기 정보가 주어지면 0번 지점부터 m번 지점까지 연속적인 선이 그어지도록 하기 위한 선긋기 최소횟수를 반환하는 프로그램을 작성하세요. 모든 입력은 0번 지점부터 m번지점까지 연속적인 선이 그어집니다. nums는 2차원 배열로 nums[i][0]은 i번째 선긋기의 시작 점, nums[i][1]은 i번째 선긋기의 끝점이다. 이 문제는 시작점을..
[문제] 휴대폰의 자판은 컴퓨터 키보드 자판과는 다르게 하나의 키에 여러 개의 문자가 할당될 수 있습니다. 키 하나에 여러 문자가 할당된 경우, 동일한 키를 연속해서 빠르게 누르면 할당된 순서대로 문자가 바뀝니다. 예를 들어, 1번 키에 "A", "B", "C" 순서대로 문자가 할당되어 있다면 1번 키를 한 번 누르면 "A", 두 번 누르면 "B", 세 번 누르면 "C"가 되는 식입니다. 같은 규칙을 적용해 아무렇게나 만든 휴대폰 자판이 있습니다. 이 휴대폰 자판은 키의 개수가 1개부터 최대 100개까지 있을 수 있으며, 특정 키를 눌렀을 때 입력되는 문자들도 무작위로 배열되어 있습니다. 또, 같은 문자가 자판 전체에 여러 번 할당된 경우도 있고, 키 하나에 같은 문자가 여러 번 할당된 경우도 있..
[문제] Write a solution to show the unique ID of each user, If a user does not have a unique ID replace just show null. Return the result table in any order. The result format is in the following example. [풀이]1. unique_id 가 존재하지 않으면 null을 표시해야하니까 employee 테이블 기준으로 LEFT 조인을 해야함2. unique_id와 name을 조회 Pandasimport pandas as pddef replace_employee_id(employees: pd.DataFrame, employee_uni: pd.DataFr..
[문제] Write a solution to find the IDs of the invalid tweets. The tweet is invalid if the number of characters used in the content of the tweet is strictly greater than 15. Return the result table in any order. [풀이]1. content 컬럼의 길이가 15가 넘어가는 행들을 필터링2. tweet_id 컬럼을 조회 Pandasimport pandas as pddef invalid_tweets(tweets: pd.DataFrame) -> pd.DataFrame: # filter = tweets['content'].str.len() >..