분류 전체보기
-
99클럽(2기) 코테 스터디 3일차 TIL # 완전탐색Algorithm 2024. 5. 30. 03:08
프로그래머스 - 소수 찾기문제: 한자리 숫자가 적힌 종이 조각이 흩어져 있습니다. 흩어진 종이 조각을 붙여 소수를 몇 개 만들 수 있는지 알아내려 합니다. 각 종이 조각에 적힌 숫자가 적힌 문자열 numbers가 주어질 때, 종이 조각으로 만들 수 있는 소수가 몇 개인지 반환하도록 solution 함수를 완성해주세요.제한 사항:numbers는 길이 1 이상 7 이하인 문자열입니다.numbers는 0~9까지 숫자만으로 이루어져 있습니다."013"은 0, 1, 3 숫자가 적힌 종이 조각이 흩어져있다는 의미입니다.1. 나의 풀이 문제 풀이에 앞서 문제를 어떻게 풀지 정리해보자면, numbers 문자열을 재배치할 수 있는 모든 경우의 수에서 소수가 몇 개인지 확인하면 된다. 소수 판별함수를 따로 만들면 좋을 것..
-
99클럽(2기) 코테 스터디 2일차 TIL # SortingAlgorithm 2024. 5. 28. 14:01
프로그래머스 - 최소 직사각형문제: 모든 명함의 가로 길이와 세로 길이를 나타내는 2차원 배열 sizes가 매개변수로 주어집니다. 모든 명함을 수납할 수 있는 가장 작은 지갑을 만들 때, 지갑의 크기를 반환하도록 solution 함수를 완성해주세요.제한사항: sizes의 길이는 1이상 10,000 이하입니다.sizes의 원소는 [w, h] 형식입니다.w는 명함의 가로 길이를 나타냅니다.h는 명함의 세로 길이를 나타냅니다.w와 h는 1이상 1,000 이하인 자연수입니다. 풀이 (시간복잡도: O(n)) 우선 문제를 풀기 쉽게 재구성해본다. sizes의 원소는 가로와 세로로 구성되어있는데, 사실 가로와 세로는 고정된 게 아니다. 직사각형을 90 회전시키면 회전 이전의 가로는 세로가, 회전 이전의 세로는 가로가..
-
99클럽(2기) 코테 스터디 1일차 TIL # Sorting # Two PointersAlgorithm 2024. 5. 28. 08:56
LeetCode 2824. Count Pairs Whose Sum is Less Than TargetGiven a 0-indexed integer array nums of length n and an integer target, return the number of pairs (i, j) where 0 and nums[i] + nums[j] .* 1 * -50 문제: n개의 integer로 구성된 array 'nums'와 integer 'target'이 주어졌을 때, 아래 조건을 만족하는 (i, j) 쌍의 개수를 반환조건: 0 1. 첫 번째 풀이 (시간복잡도: O(n^2))1) answer값 초기화 answer 값을 0으로 초기화한다. 2) 조건을 만족하는 nums의 인덱스 (i, j) 쌍 찾기 ..
-
[비대칭키 알고리즘] DH, RSA의 수학적 자물쇠와 그 취약점 보완Algorithm 2024. 4. 17. 01:30
들어가며 HTTPS의 주요 기술인 '키 교환'과 '디지털 서명'은 '비대칭키' 알고리즘을 사용합니다. 비대칭키는 '개인키'-'공개키' 쌍으로 이루어진 키를 말하는데, 공개키는 말 그대로 누구에게나 공개되는 반면, 개인키는 비밀로 유지되어야 합니다. 이 글에서는 키 교환과 디지털 서명의 대표적인 알고리즘인 DH(Diffie-Hellman)와 RSA(Riveset-Shamir-Adelman)를 다룹니다. 비대칭키 방식의 DH와 RSA는 정방향으로 계산하기 쉽지만 역방향 계산은 어려운 '일방향 함수'의 개념을 활용합니다. 예를 들어, 큰 두 수의 곱셈은 쉽지만 큰 합성수에 대한 소인수 분해는 어렵습니다. 이와 같이 DH로 생성된 대칭키를 유추하거나, RSA로 암호화된 데이터를 복호화하려면 매우 어려운 역 연..
-
코드트리 사용 후기 #2Algorithm 2024. 4. 6. 23:50
벌써 코드트리를 사용해본지 두 달이 되었네요. 두달 동안 코드트리를 사용해본 결과, 제가 지속적으로 느낀 코드트리의 차별화된 특장점으로 '상세한 개념 설명'과 '질문에 대한 빠른 피드백'을 꼽아봤습니다. 장점 1. 상세한 개념 설명 코드트리의 커리큘럼은 '프로그래밍 기초' - '프로그래밍 연습' - '자료구조・알고리즘' - '알고리즘 입문' - '알고리즘 기본' - '알고리즘 실전'으로 구성되어있습니다. 저는 첫 달에 실력 진단 결과에 따라 '알고리즘 입문'으로 시작했습니다. 그래서 '알고리즘 입문'을 마스터한 후 두번째 달에는 '알고리즘 기본'까지 끝낼 계획이었지만, 문제 풀이에 있어서 친절한 개념 설명의 도움을 많이 받고있다는 것을 체감하고는 개념 설명이 위주인 '프로그래밍 기초'로 커리큘럼을 변경했..
-
[HTTPS] SSL/TLS Handshake란?NetWork 2024. 4. 4. 02:34
들어가며 인터넷 보안은 개인, 기업, 나아가 국가적 차원에서 정보 보호와 사이버 범죄 예방에 필수적인 요소입니다. 관련 법안도 존재합니다. 개인정보를 취급하는 모든 웹사이트는 2016년 3월 22일 이후로 ⌜정보통신망법⌟ 제 28조 1항 제4호에 따라 의무적으로 HTTPS 서버를 구축해야 하며, 위반 시 3천만원 이하의 과태료가 부과됩니다. HTTPS 서버를 구축한다는 것은 SSL/TLS 인증서를 사용한다는 의미입니다. SSL/TLS는 HTTPS 통신의 핵심으로, 웹 서버와 클라이언트 간의 안전한 데이터 전송을 보장하기 위해 개발된 보안 프로토콜입니다. 또한 웹 사이트의 신뢰성을 유지하기 위한 방법이기도 합니다. 참고로 SSL이면 SSL이고 TLS면 TLS지, SSL/TLS는 도대체 무..
-
[웹 통신 과정 해부하기] 네트워크 접속부터 브라우저 렌더링까지NetWork 2024. 3. 31. 16:50
들어가며 클라이언트가 네트워크에 연결된 후 브라우저에서 특정 도메인을 검색하고, 그 결과 렌더링된 페이지가 보여지기까지의 과정을 자세히 살펴보겠습니다. 이 글에서는 '클라이언트의 관점'에서 웹 서버에 접속하기 위해 필요한 핵심 요소들에 집중합니다. 따라서 클라이언트의 웹 서버 최초 접속 이후 서버가 클라이언트의 상태를 유지하거나 식별하기 위해 사용하는 세션, 쿠키, 토큰과 같은 기술에 대해서는 다루지 않습니다. 목차는 아래와 같습니다. 목차1. ISP 네트워크에 접속2. IP 할당3. 서버 IP 변환4. 서버와의 연결 구축5. HTTP(S) Request 메세지 생성 및 송신6. HTTP(S) Response 메세지 수신7. 브라우저 렌더링8. 마무리9. Reference 1. ISP 네트워크에 접속..
-
[Python 2차원 리스트] 리스트 반복과 리스트 컴프리헨션의 차이Python/Grammar 2024. 3. 12. 13:55
알고리즘 문제를 풀면서 '리스트 반복'과 '리스트 컴프리헨션'이 각각 어떻게 1차원 리스트로부터 2차원 리스트를 'copy'하는지 그 차이를 알게되었다.리스트 반복2차원 리스트 생성 방법: [[0] * m] * n1차원 리스트 '[[0] * m]' 를 'n'번 반복해서 2차원 리스트를 생성할 때 shallow copy를 수행함. 즉, 모든 행이 동일한 리스트 객체를 참조하게 되므로 한 행의 데이터를 변경하면 모든 행에 그 변경점이 반영됨. 리스트 컴프리헨션2차원 리스트 생성 방법: [[0] * m for _ in range(n)]'n'번만큼 for 문으로 '[0] * m'의 결과를 새로 생성하는 과정을 반복해서 2차원 리스트를 생성함. 각 반복마다 독립적인 리스트가 생성되기 때문에 deep copy의..