본문 바로가기

분류 전체보기31

[Leetcode 826번 문제] 826. Most Profit Assigning Work 문제 상황You have n jobs and m workers. You are given three arrays: difficulty, profit, and worker where:difficulty[i] and profit[i] are the difficulty and the profit of the ith job, andworker[j] is the ability of jth worker (i.e., the jth worker can only complete a job with difficulty at most worker[j]).Every worker can be assigned at most one job, but one job can be completed multiple times.For ex.. 2024. 6. 18.
[Leetcode 633번 문제] 633. Sum of Square Numbers 문제 상황Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c.c가 두개의 제곱수의 합으로 나타낼 수 있는지 확인하라는 문제입력정수 c출력제곱수의 합으로 나타낼 수 있는지에 대한 불값과정일단 c는 제곱수의 합이기 때문에 특정c - 특정 제곱수가 제곱수인지 확인하는 문제여도됨.그럼 모든 제곱수들을 저장해놓고 그냥 해시하면 되지 않을까?대충 2 ** 16번의 계산만 하면 돼서 문제 없다고 생각했다.알고리즘 개요도 알고리즘class Solution { typedef long long ll; unordered_map container;public: bool judgeSqua.. 2024. 6. 17.
[Leetcode 330번 문제] 330. Patching Array 문제 상황Given a sorted integer array nums and an integer n, add/patch elements to the array such that any number in the range [1, n] inclusive can be formed by the sum of some elements in the array.Return the minimum number of patches required.nums의 정렬 배열이 있고 n이라는 정수를 추가할 거임, 요소를 add/patch 한다, 1부터 n까지의 모든 수를 배열안의 수로 제작할 수 있게 되는 최소의 변형 수를 구하는 문제입력1 1 nums is sorted in ascending order.1 출력배열의 조합으로 [1.. 2024. 6. 17.
[네트워크] IP프로토콜 분석 들어가며네트워크 CS에는 신기한 녀석이 살고있다. 바로 계층구조OSI 7단계와 TCP/IP 4계층이라고도 하는 녀석들이다 얘네는 실제 프로젝트에서 경험할 일이 없는 녀석이다 보니 외워도 까먹고 외워도 까먹고 항상 그렇다. 그 멍청한 연쇄를 끊고자 실제 실습을 겸해서 네트워크 공부를 하려고한다.개념TCP/IP 계층과 OSI 7계층은 같은 개념이고 그중에서 ip 프로토콜은 인터넷 계층의 프로토콜의 일종이다. 그냥 추상적으로 프로토콜을 공부하기는 힘들어서 C++의 ip 프로토콜을 직접 담당하는 라이브러리를 읽으면서 분석해보자 ip 모듈의 분해struct ip {#ifdef _IP_VHL u_char ip_vhl; /* version > 2 */#else#if BYTE_ORD.. 2024. 6. 16.