From d9c2ed8d9b1c79402a112d70ce5c93ac4ef25031 Mon Sep 17 00:00:00 2001 From: Won Joon Thomas Choi <113500771+724thomas@users.noreply.github.com> Date: Sun, 27 Sep 2026 21:51:40 +0900 Subject: [PATCH 1/2] Create 857. Minimum Cost to Hire K Workers.py --- .../857. Minimum Cost to Hire K Workers.py" | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 "leetcode3/\354\265\234\354\233\220\354\244\200/857. Minimum Cost to Hire K Workers.py" diff --git "a/leetcode3/\354\265\234\354\233\220\354\244\200/857. Minimum Cost to Hire K Workers.py" "b/leetcode3/\354\265\234\354\233\220\354\244\200/857. Minimum Cost to Hire K Workers.py" new file mode 100644 index 00000000..8188c85f --- /dev/null +++ "b/leetcode3/\354\265\234\354\233\220\354\244\200/857. Minimum Cost to Hire K Workers.py" @@ -0,0 +1,33 @@ +import heapq + + +class Solution: + def mincostToHireWorkers( + self, + quality: list[int], + wage: list[int], + k: int + ) -> float: + workers = [] + + for q, w in zip(quality, wage): + workers.append((w / q, q)) + + workers.sort() + + heap = [] + quality_sum = 0 + ans = float("inf") + + for ratio, q in workers: + heapq.heappush(heap, -q) + quality_sum += q + + if len(heap) > k: + max_quality = -heapq.heappop(heap) + quality_sum -= max_quality + + if len(heap) == k: + ans = min(ans, ratio * quality_sum) + + return ans From 3ab4c0a9858458719cba4396d3a76ba8c6f25cd9 Mon Sep 17 00:00:00 2001 From: Won Joon Thomas Choi <113500771+724thomas@users.noreply.github.com> Date: Sun, 27 Sep 2026 21:51:59 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Rename=20leetcode3/935.=20Knight=20Dialer.p?= =?UTF-8?q?y=20to=20leetcode3/=EC=B5=9C=EC=9B=90=EC=A4=80/935.=20Knight=20?= =?UTF-8?q?Dialer.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\354\265\234\354\233\220\354\244\200/935. Knight Dialer.py" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename leetcode3/935. Knight Dialer.py => "leetcode3/\354\265\234\354\233\220\354\244\200/935. Knight Dialer.py" (100%) diff --git a/leetcode3/935. Knight Dialer.py "b/leetcode3/\354\265\234\354\233\220\354\244\200/935. Knight Dialer.py" similarity index 100% rename from leetcode3/935. Knight Dialer.py rename to "leetcode3/\354\265\234\354\233\220\354\244\200/935. Knight Dialer.py"