{"kind":"task","effective_mode":"full","benchmark":{"kind":"benchmark","effective_mode":"full","slug":"livecodebench","formal_name":"LiveCodeBench","introduction":"競技プログラミングの新しい問題を継続的に収集し、コードに関する能力を評価するベンチマークです。初期release_v1は400問で、問題の出題元と公開日時、データセットの版を区別して扱います。\n\nLiveCodeBench continuously collects new competitive-programming problems to evaluate coding capabilities. Its initial release_v1 contains 400 problems, with source platform, contest date, and dataset version tracked explicitly.","introduction_ja":"","introduction_en":"","category":"Category not supplied","task_count":null,"acquisition_status":"Acquisition status not supplied","official_url":"https://livecodebench.github.io/","indexing_mode":"noindex"},"task_id":"70640610-934c-5d7b-a161-4dace90b2785","task_key":"release~5fv1--test--2755","task_revision_id":"1","upstream_id":"2755","short_description":"extra-characters-in-a-string","config":"release_v1","split":"test","body":"{\"contest_date\":\"2023-05-27T00:00:00\",\"contest_id\":\"biweekly-contest-105\",\"difficulty\":\"medium\",\"platform\":\"leetcode\",\"question_content\":\"You are given a 0-indexed string s and a dictionary of words dictionary. You have to break s into one or more non-overlapping substrings such that each substring is present in dictionary. There may be some extra characters in s which are not present in any of the substrings.\\nReturn the minimum number of extra characters left over if you break up s optimally.\\n \\nExample 1:\\n\\nInput: s = \\\"leetscode\\\", dictionary = [\\\"leet\\\",\\\"code\\\",\\\"leetcode\\\"]\\nOutput: 1\\nExplanation: We can break s in two substrings: \\\"leet\\\" from index 0 to 3 and \\\"code\\\" from index 5 to 8. There is only 1 unused character (at index 4), so we return 1.\\n\\n\\nExample 2:\\n\\nInput: s = \\\"sayhelloworld\\\", dictionary = [\\\"hello\\\",\\\"world\\\"]\\nOutput: 3\\nExplanation: We can break s in two substrings: \\\"hello\\\" from index 3 to 7 and \\\"world\\\" from index 8 to 12. The characters at indices 0, 1, 2 are not used in any substring and thus are considered as extra characters. Hence, we return 3.\\n\\n \\nConstraints:\\n\\n1 <= s.length <= 50\\n1 <= dictionary.length <= 50\\n1 <= dictionary[i].length <= 50\\ndictionary[i] and s consists of only lowercase English letters\\ndictionary contains distinct words\",\"question_title\":\"extra-characters-in-a-string\",\"starter_code\":\"class Solution:\\n    def minExtraChar(self, s: str, dictionary: List[str]) -> int:\\n        \"}","display_format":"text","language":"","answer_status":"published","assets":[],"source_url":"https://livecodebench.github.io/","history":"initial import","indexing_mode":"noindex","subproblems":[],"grids":[]}