목록2024/05 (33)
넘치게 채우기
https://leetcode.com/problems/minimum-cost-to-hire-k-workers/description/leetcode - Minimum Cost to Hire K Workers문제 유형 : 우선순위 큐, 정렬문제 난이도 : Hard 문제There are n workers. You are given two integer arrays quality and wage where quality[i] is the quality of the ith worker and wage[i] is the minimum wage expectation for the ith worker.We want to hire exactly k workers to form a paid group. To hire a ..
https://leetcode.com/problems/k-th-smallest-prime-fraction/description/leetcode - K-th Smallest Prime Fraction문제 유형 : 이진탐색, 브루트 포스문제 난이도 : Medium 문제You are given a sorted integer array arr containing 1 and prime numbers, where all the integers of arr are unique. You are also given an integer k.For every i and j where 0 arr[i] / arr[j].Return the kth smallest fraction considered. Return your ans..
int INT_MAX = (unsigned int) -1 >> 1; 본론부터 말하자면, 위와 같다. 1을 4비트 + 부호비트로 표현하면, 00001이다.-1은? 2의 보수를 취하여 11111이다. unsigned로 형변환하면서, MSB인 부호 비트도 수 표현 비트로 바뀌면서, -1은 1이 32개 나열된 비트로 바뀐다.이 값에서 다시 오른쪽 시프트 연산을 하여 최하위 비트를 자르면? 1이 31개 나열된 채로, 2^31-1로 된다. 즉, INT_MAX의 값이 된다.
https://leetcode.com/problems/maximize-happiness-of-selected-children/description/leetcode - Maximize Happiness of Selected Children문제 유형 : 정렬 / 그리디문제 난이도 : Medium 문제You are given an array happiness of length n, and a positive integer k.There are n children standing in a queue, where the ith child has happiness value happiness[i]. You want to select k children from these n children in k turns.In..
https://leetcode.com/problems/relative-ranks/description/leetcode - Relative Ranks문제 유형 : 우선순위 큐문제 난이도 : Easy 문제You are given an integer array score of size n, where score[i] is the score of the ith athlete in a competition. All the scores are guaranteed to be unique.The athletes are placed based on their scores, where the 1st place athlete has the highest score, the 2nd place athlete has the 2n..
https://leetcode.com/problems/double-a-number-represented-as-a-linked-list/description/leetcode - Double a Number Represented as a Linked List문제 유형 : 연결 리스트, 재귀문제 난이도 : Medium 문제You are given the head of a non-empty linked list representing a non-negative integer without leading zeroes.Return the head of the linked list after doubling it. 연결리스트의 Head를 받습니다.이 연결리스트는 양의 정수를 의미합니다.두 배 하시오. 풀이재귀적으로 ..
https://school.programmers.co.kr/learn/courses/30/lessons/84021 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr프로그래머스 - 퍼즐 조각 채우기문제 유형 : bfs, 구현문제 난이도 : Level 3 문제테이블 위에 놓인 퍼즐 조각을 게임 보드의 빈 공간에 적절히 올려놓으려 합니다. 게임 보드와 테이블은 모두 각 칸이 1x1 크기인 정사각 격자 모양입니다. 이때, 다음 규칙에 따라 테이블 위에 놓인 퍼즐 조각을 게임 보드의 빈칸에 채우면 됩니다.조각은 한 번에 하나씩 채워 넣습니다.조각을 회전시킬 수 있습니다...
https://leetcode.com/problems/remove-nodes-from-linked-list/description/leetcode - Remove Nodes From Linked List문제 유형 : 연결 리스트, 재귀, 스택문제 난이도 : Medium 문제You are given the head of a linked list.Remove every node which has a node with a greater value anywhere to the right side of it.Return the head of the modified linked list. 연결리스트의 head가 주어진다.노드의 다음 노드들 중 더 큰 값이 있다면, 그 노드를 삭제하라.모든 작업이 끝나고 나서의 연결 ..
https://leetcode.com/problems/delete-node-in-a-linked-list/description/leetcode - Delete Node in a Linked List문제 유형 : 연결리스트문제 난이도 : Medium 문제There is a singly-linked list head and we want to delete a node node in it.You are given the node to be deleted node. You will not be given access to the first node of head.All the values of the linked list are unique, and it is guaranteed that the given no..
https://leetcode.com/problems/boats-to-save-people/description/leetcode - Boats to Save People문제 유형 : 정렬, 그리디, 투 포인터문제 난이도 : Medium 문제You are given an array people where people[i] is the weight of the ith person, and an infinite number of boats where each boat can carry a maximum weight of limit. Each boat carries at most two people at the same time, provided the sum of the weight of those peopl..