본문 바로가기

알고리즘연구소👨‍💻

(17)
[Leetcode 2064번 문제] 2064. Minimized Maximum of Products Distributed to Any Store 문제 상황You are given an integer n indicating there are n specialty retail stores. There are m product types of varying amounts, which are given as a 0-indexed integer array quantities, where quantities[i] represents the number of products of the ith product type.You need to distribute all products to the retail stores following these rules:A store can only be given at most one product type but can..
[Leetcode 465번 문제] 465. Optimal Account Balancing 문제 상황You are given an array of transactions transactions where transactions[i] = [fromi, toi, amounti] indicates that the person with ID = fromi gave amounti $ to the person with ID = toi.Return the minimum number of transactions required to settle the debt.transactions 배열이 주어진다 각 요소는 a부터, b까지 c만큼 라는 뜻, a, b 는 ID고 c는 달러다.debt를 내지 않기 위해서 필요한 가장 작은 transaction의 수를 구하여라Input: transactions = [[0,1,1..
[Leetcode 2601번 문제] 2601. Prime Subtraction Operation 문제 상황You are given a 0-indexed integer array nums of length n.You can perform the following operation as many times as you want:Pick an index i that you haven’t picked before, and pick a prime p strictly less than nums[i], then subtract p from nums[i].Return true if you can make nums a strictly increasing array using the above operation and false otherwise.A strictly increasing array is an array..
[Leetcode 3133번 문제] 3133. Minimum Array End 문제 상황You are given two integers n and x. You have to construct an array of positive integers nums of size n where for every 0 greater than nums[i], and the result of the bitwise AND operation between all elements of nums is x.Return the minimum possible value of nums[n - 1].n과 x가 주어진다, 배열을 만들어야한다 정수배열 n의 크기를 갖는 nums를 만든다.그 특징은 왼쪽보다 오른쪽이 항상 크다.nums의 배열의 모든 요소 사이의 AND가 x이다.모든 가능한 nums[n - 1]의 값중 가..
[Leetcode 1829번 문제] 1829. Maximum XOR for Each Query 문제 상황You are given a sorted array nums of n non-negative integers and an integer maximumBit. You want to perform the following query n times:Find a non-negative integer k maximized. k is the answer to the ith query.Remove the last element from the current array nums.Return an array answer, where answer[i] is the answer to the ith query.배열이 존재하고 특정한 정수 maximumBit이 있다. 이하의 작업을 n번 반복한다처음부터 끝까지의 요소를..
[Leetcode 2275번 문제] 2275. Largest Combination With Bitwise AND Greater Than Zero 문제 상황The bitwise AND of an array nums is the bitwise AND of all integers in nums.For example, for nums = [1, 5, 3], the bitwise AND is equal to 1 & 5 & 3 = 1.Also, for nums = [7], the bitwise AND is 7.You are given an array of positive integers  candidates.Evaluate the bitwise AND of every combination of numbers of candidates. Each number in candidates may only be used once in each combination.조..
[Leetcode 1052번 문제] 1052. Grumpy Bookstore Owner 문제 상황There is a bookstore owner that has a store open for n minutes. Every minute, some number of customers enter the store. You are given an integer array customers of length n where customers[i] is the number of the customer that enters the store at the start of the ith minute and all those customers leave after the end of that minute.On some minutes, the bookstore owner is grumpy. You are giv..
[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..