개발일지

심화 과정 3 일차

오늘도개발 2024. 2. 7. 13:59

1. 자료구조 및 알고리즘 3일차 수강하기

 

 - 해시 테이블

딕셔너리 문법으로 사용

 

2. 새롭게 알게된 지식

 

 과제1 : 보석과 돌 https://leetcode.com/problems/jewels-and-stones

 

LeetCode - The World's Leading Online Programming Learning Platform

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

 

 - 접근

 

 - 코드 구현

 

 

 

 

 과제2 : 중복 문자가 없는 가장 긴 부분 문자열 https://leetcode.com/problems/longest-substring-without-repeating-characters

 

LeetCode - The World's Leading Online Programming Learning Platform

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

 

 - 접근

 

 예시 1 :

 예시 2 :

 

 

 

 - 코드 구현 :

 

 

 

 

과제 3 : 상위 K 빈도 요소 https://leetcode.com/problems/top-k-frequent-elements

 

LeetCode - The World's Leading Online Programming Learning Platform

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

 

 - 접근 :

 

 

 - 코드 구현 : 

 

 

과제 4 : 수 찾기 : https://www.acmicpc.net/problem/1920

 

1920번: 수 찾기

첫째 줄에 자연수 N(1 ≤ N ≤ 100,000)이 주어진다. 다음 줄에는 N개의 정수 A[1], A[2], …, A[N]이 주어진다. 다음 줄에는 M(1 ≤ M ≤ 100,000)이 주어진다. 다음 줄에는 M개의 수들이 주어지는데, 이 수들

www.acmicpc.net

 

 

 - 접근 : 

 - 코드 구현 : 

 

* 특이사항 :

    정답을 제출할 때, def 없이 코드를 작성 후 print 출력을 하면  : 668 ms 소요

    def 후 함수 호출형으로 작성하면 : 140 ms 소요

      - python 은 인터프리터 방식이기 때문에 한줄씩 해석하는 과정에서 반복문에서 느린 경우가 발생한다. pypy3를 사용하거나 함수를 정의해서 호출하면 컴파일이 실행됨으로 시간을 줄일 수 있다. 

         pypy : 코드를 기계어로 번역 후 실행

         python : 코드를 바이트로 변환 후 가상머신에서 실행

 

 

 

과제 5 : 비밀번호 찾기 : https://www.acmicpc.net/problem/17219

 

17219번: 비밀번호 찾기

첫째 줄에 저장된 사이트 주소의 수 N(1 ≤ N ≤ 100,000)과 비밀번호를 찾으려는 사이트 주소의 수 M(1 ≤ M ≤ 100,000)이 주어진다. 두번째 줄부터 N개의 줄에 걸쳐 각 줄에 사이트 주소와 비밀번

www.acmicpc.net

 

 - 접근 : 

받은 문자열을 나누어 email을 키 , password 를 value로 설정한다.

이후 입력 받은 email 에 대한 password를 출력

 

 - 코드 구현 : 

 

'개발일지' 카테고리의 다른 글

2주차 WIL  (0) 2024.02.09
심화 과정 4 일차  (1) 2024.02.08
심화 과정 2 일차  (0) 2024.02.06
심화 과정 1 일차  (1) 2024.02.05
1주차 WIL  (0) 2024.02.02