From dc7ad0a2fa4075c8ba3cd8b58dd2360d4979a46f Mon Sep 17 00:00:00 2001 From: zzu <90972641+Zuhye@users.noreply.github.com> Date: Thu, 12 Nov 2026 23:26:37 +0900 Subject: [PATCH 1/3] 988. Smallest String Starting From Leaf --- ...t 988. Smallest String Starting From Leaf" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "leetcode3/\354\206\241\354\243\274\355\230\234/Code Testcase Testcase Test Result 988. Smallest String Starting From Leaf" diff --git "a/leetcode3/\354\206\241\354\243\274\355\230\234/Code Testcase Testcase Test Result 988. Smallest String Starting From Leaf" "b/leetcode3/\354\206\241\354\243\274\355\230\234/Code Testcase Testcase Test Result 988. Smallest String Starting From Leaf" new file mode 100644 index 00000000..47b1abfc --- /dev/null +++ "b/leetcode3/\354\206\241\354\243\274\355\230\234/Code Testcase Testcase Test Result 988. Smallest String Starting From Leaf" @@ -0,0 +1,28 @@ +# Definition for a binary tree node. +# class TreeNode: +# def __init__(self, val=0, left=None, right=None): +# self.val = val +# self.left = left +# self.right = right +from collections import deque + +class Solution: + def smallestFromLeaf(self, root: TreeNode | None) -> str: + def ch(node): + return chr(node.val + 97) # 'a': 97 + + result = [] + q = deque([(root, ch(root))]) + + while q: + node, cur = q.popleft() + if not node.left and not node.right: + result.append(cur) + continue + if node.left: + q.append((node.left, ch(node.left) + cur)) + if node.right: + q.append((node.right, ch(node.right) + cur)) + + + return min(result) From 5ce8a574b7b6e9b02f9c8ad1fc43a46b30108104 Mon Sep 17 00:00:00 2001 From: zzu <90972641+Zuhye@users.noreply.github.com> Date: Thu, 12 Nov 2026 23:27:19 +0900 Subject: [PATCH 2/3] 988. Smallest String Starting From Leaf --- ...Starting From Leaf" => 988. Smallest String Starting From Leaf | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "leetcode3/\354\206\241\354\243\274\355\230\234/Code Testcase Testcase Test Result 988. Smallest String Starting From Leaf" => 988. Smallest String Starting From Leaf (100%) diff --git "a/leetcode3/\354\206\241\354\243\274\355\230\234/Code Testcase Testcase Test Result 988. Smallest String Starting From Leaf" b/988. Smallest String Starting From Leaf similarity index 100% rename from "leetcode3/\354\206\241\354\243\274\355\230\234/Code Testcase Testcase Test Result 988. Smallest String Starting From Leaf" rename to 988. Smallest String Starting From Leaf From 1abc60341ea98efe8e6f20ac0befa728c26499c3 Mon Sep 17 00:00:00 2001 From: zzu <90972641+Zuhye@users.noreply.github.com> Date: Thu, 12 Nov 2026 23:33:25 +0900 Subject: [PATCH 3/3] 2305. Fair Distribution of Cookies --- .../2305. Fair Distribution of Cookies" | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 "leetcode3/\354\206\241\354\243\274\355\230\234/2305. Fair Distribution of Cookies" diff --git "a/leetcode3/\354\206\241\354\243\274\355\230\234/2305. Fair Distribution of Cookies" "b/leetcode3/\354\206\241\354\243\274\355\230\234/2305. Fair Distribution of Cookies" new file mode 100644 index 00000000..35631251 --- /dev/null +++ "b/leetcode3/\354\206\241\354\243\274\355\230\234/2305. Fair Distribution of Cookies" @@ -0,0 +1,11 @@ +class Solution: + def distributeCookies(self, cookies: list[int], k: int) -> int: + cookies.sort(reverse=True) + result = 10e9 + + def dfs(idx): + + + dfs(0) + + return result