diff --git "a/leetcode3/\354\265\234\354\233\220\354\244\200/1665. Minimum Initial Energy to Finish Tasks.py" "b/leetcode3/\354\265\234\354\233\220\354\244\200/1665. Minimum Initial Energy to Finish Tasks.py" new file mode 100644 index 000000000..7ca3a2b2e --- /dev/null +++ "b/leetcode3/\354\265\234\354\233\220\354\244\200/1665. Minimum Initial Energy to Finish Tasks.py" @@ -0,0 +1,12 @@ +class Solution: + def minimumEffort(self, tasks: list[list[int]]) -> int: + tasks.sort(key=lambda x: x[1] - x[0], reverse=True) + + ans = 0 + curr = 0 + + for actual, minimum in tasks: + ans = max(ans, curr + minimum) + curr += actual + + return ans diff --git a/leetcode3/284. Peeking Iterator.py "b/leetcode3/\354\265\234\354\233\220\354\244\200/284. Peeking Iterator.py" similarity index 100% rename from leetcode3/284. Peeking Iterator.py rename to "leetcode3/\354\265\234\354\233\220\354\244\200/284. Peeking Iterator.py"