FPEvalDataset/LeetCodeProblem
0304
1{2 "id": 2877,3 "name": "shortest_string_that_contains_three_strings",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/shortest-string-that-contains-three-strings/",6 "date": "1690070400000",7 "task_description": "Given three strings `a`, `b`, and `c`, your task is to find a string that has the** minimum** length and contains all three strings as **substrings**. If there are multiple such strings, return the_ _**lexicographically_ _smallest **one. Return _a string denoting the answer to the problem._ **Notes** A string `a` is **lexicographically smaller** than a string `b` (of the same length) if in the first position where `a` and `b` differ, string `a` has a letter that appears **earlier **in the alphabet than the corresponding letter in `b`. A **substring** is a contiguous sequence of characters within a string. **Example 1:** ``` **Input:** a = \"abc\", b = \"bca\", c = \"aaa\" **Output:** \"aaabca\" **Explanation:** We show that \"aaabca\" contains all the given strings: a = ans[2...4], b = ans[3..5], c = ans[0..2]. It can be shown that the length of the resulting string would be at least 6 and \"aaabca\" is the lexicographically smallest one. ``` **Example 2:** ``` **Input:** a = \"ab\", b = \"ba\", c = \"aba\" **Output:** \"aba\" **Explanation: **We show that the string \"aba\" contains all the given strings: a = ans[0..1], b = ans[1..2], c = ans[0..2]. Since the length of c is 3, the length of the resulting string would be at least 3. It can be shown that \"aba\" is the lexicographically smallest one. ``` **Constraints:** `1 <= a.length, b.length, c.length <= 100` `a`, `b`, `c` consist only of lowercase English letters.",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "a = \"abc\", b = \"bca\", c = \"aaa\"",12 "output": "\"aaabca\" "13 },14 {15 "label": "Example 2",16 "input": "a = \"ab\", b = \"ba\", c = \"aba\"",17 "output": "\"aba\" "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 "\"wrgzetkwycvrgbirwclrwsblkfecsertsvaqgbrwpfprbwzbocsgodxwllwdrknyxitc\"",24 "\"welaunojcdczlkxwsvcnqdrkaetpnjzfynwflvzgtmxmvgjrfpv\"",25 "\"donsfsswccihyitepvoegeqpuugpomgvxidpvrjgtamybibwdgnynixcgvoorvqzxsivn\""26 ],27 "output": "donsfsswccihyitepvoegeqpuugpomgvxidpvrjgtamybibwdgnynixcgvoorvqzxsivnwelaunojcdczlkxwsvcnqdrkaetpnjzfynwflvzgtmxmvgjrfpvwrgzetkwycvrgbirwclrwsblkfecsertsvaqgbrwpfprbwzbocsgodxwllwdrknyxitc"28 },29 {30 "input": [31 "\"asigvexrzpfmorvvvnscwqnpniqezvxiv\"",32 "\"tfqajcelaqupacpizucsjqfxxi\"",33 "\"ssrbvodscludzisopjkmygcgpynvwnzrsasgxrmukqgofpswxahqljtiee\""34 ],35 "output": "asigvexrzpfmorvvvnscwqnpniqezvxivssrbvodscludzisopjkmygcgpynvwnzrsasgxrmukqgofpswxahqljtieetfqajcelaqupacpizucsjqfxxi"36 },37 {38 "input": [39 "\"xuavyormuebkvvoubjhaupmqvhdwwkmnrycauhrxsnqvtroiwvwevqgdqao\"",40 "\"hldznvfqomsmncuaigxonrywewxfhlxhlctekjdgdymhoqabqgcalqwgeyitgyoxsdasddvntg\"",41 "\"qvhqhuvovfxosgzkolzftbhmqbzjvnjwxbbduiqawwvwjrzscudvbzzpooiyubpcfmakcdajgqmpkjmryimhsiuenlaebux\""42 ],43 "output": "hldznvfqomsmncuaigxonrywewxfhlxhlctekjdgdymhoqabqgcalqwgeyitgyoxsdasddvntgqvhqhuvovfxosgzkolzftbhmqbzjvnjwxbbduiqawwvwjrzscudvbzzpooiyubpcfmakcdajgqmpkjmryimhsiuenlaebuxuavyormuebkvvoubjhaupmqvhdwwkmnrycauhrxsnqvtroiwvwevqgdqao"44 },45 {46 "input": [47 "\"chawduquqsxdvkazntomogvtnwaye\"",48 "\"vpydaguxlrmdrnifusdxvuqtlgovvukxzvpkkltrcrsygaubqxqadahxizbmhsobvqorhsxgfuyong\"",49 "\"epnvrgokwfpqzfjeewjrfoedkcbnpohpwzjoyzyxthspbsqkiemgcvhpdwgulkwcvjgsdwwgtzujnebillgxwrqticxzrjeqdy\""50 ],51 "output": "chawduquqsxdvkazntomogvtnwayepnvrgokwfpqzfjeewjrfoedkcbnpohpwzjoyzyxthspbsqkiemgcvhpdwgulkwcvjgsdwwgtzujnebillgxwrqticxzrjeqdyvpydaguxlrmdrnifusdxvuqtlgovvukxzvpkkltrcrsygaubqxqadahxizbmhsobvqorhsxgfuyong"52 },53 {54 "input": [55 "\"mvzsexjyjlpdnijvmooi\"",56 "\"qwalgakythuyisqnohqaecwjmkzfexoxkbanfochftvebyoswpsptegvwfyeevjmrfgt\"",57 "\"tutpewbuzyuuqmxpfrqnwrhunvwptjvmvcrqbbhapeycevowctorbipzivgzvcg\""58 ],59 "output": "mvzsexjyjlpdnijvmooiqwalgakythuyisqnohqaecwjmkzfexoxkbanfochftvebyoswpsptegvwfyeevjmrfgtutpewbuzyuuqmxpfrqnwrhunvwptjvmvcrqbbhapeycevowctorbipzivgzvcg"60 },61 {62 "input": [63 "\"vtzfav\"",64 "\"rmyuzojrsmarrperkdnboojzmzwuunbfkhuypwhpouxsrtbpdy\"",65 "\"xzeqjrphbdfgwdctrbzmggxshcteroifystaecbkqozdpfcjivawqqknokfueljqwrpsujtwjiqefj\""66 ],67 "output": "rmyuzojrsmarrperkdnboojzmzwuunbfkhuypwhpouxsrtbpdyvtzfavxzeqjrphbdfgwdctrbzmggxshcteroifystaecbkqozdpfcjivawqqknokfueljqwrpsujtwjiqefj"68 },69 {70 "input": [71 "\"lwxsqaxhnspgnmiyhchuyutervllkafqlpwhkfheqshbslcqxtlnnsbgfvslmybcxpogbwrrgwaufscnobbaqtyrjzyhfonrzwyj\"",72 "\"qelfibnsshwxrezdrvcyokwbbmiejorrghbvxgvtbhlmglgmxxdomdbhiaolpcwrmrwhsjhrdxvsylugpy\"",73 "\"sdzjnhkgtumlhnpdpwnpnajwwgqpdknxihjprfztlalpaktu\""74 ],75 "output": "lwxsqaxhnspgnmiyhchuyutervllkafqlpwhkfheqshbslcqxtlnnsbgfvslmybcxpogbwrrgwaufscnobbaqtyrjzyhfonrzwyjqelfibnsshwxrezdrvcyokwbbmiejorrghbvxgvtbhlmglgmxxdomdbhiaolpcwrmrwhsjhrdxvsylugpysdzjnhkgtumlhnpdpwnpnajwwgqpdknxihjprfztlalpaktu"76 },77 {78 "input": [79 "jetiayntmsvinhnausvipvm",80 "uodgvemykvyxrnwnuqffyrnezfvnlopnvmpdasoddjwievdtzjgoaroylmdmbfkncuvhqfckgknbeyyrbavfwyzeodqsg",81 "pitawhxiwobktcxzvaokqejexhcvptrpowgkizcrbufvtozijkknfyreffmftomnssm"82 ],83 "output": "jetiayntmsvinhnausvipvmpitawhxiwobktcxzvaokqejexhcvptrpowgkizcrbufvtozijkknfyreffmftomnssmuodgvemykvyxrnwnuqffyrnezfvnlopnvmpdasoddjwievdtzjgoaroylmdmbfkncuvhqfckgknbeyyrbavfwyzeodqsg"84 },85 {86 "input": [87 "rsbtxhhveiwkzbtholezcathmxfvjjylqj",88 "kfkrjxwlmdjryosfwvihpqeirbqhhbaxrkzdsyutdvdfsoljfxmtghglwlhozzulyvhtbrpwhszksjxqkxkqoyqxqnt",89 "twidpgqgspgudpoxibzzwyvqiwfkujjoeazxjdydurfjqfafgsnvxymrekwlmwcosakcbhsxpmkkmdovpssrfjfwlraeoxi"90 ],91 "output": "kfkrjxwlmdjryosfwvihpqeirbqhhbaxrkzdsyutdvdfsoljfxmtghglwlhozzulyvhtbrpwhszksjxqkxkqoyqxqntwidpgqgspgudpoxibzzwyvqiwfkujjoeazxjdydurfjqfafgsnvxymrekwlmwcosakcbhsxpmkkmdovpssrfjfwlraeoxirsbtxhhveiwkzbtholezcathmxfvjjylqj"92 },93 {94 "input": [95 "foycvolzkbafijihpaffpmbohpxekfwmrmjkqlyuinxdnxmvbnmgdjwzploaanuyvphvstsjypeejzmfsuqjafloycjwggqae",96 "physhjizrulnpjnhawppmbodqnfsndfatunrydrsnhplisxtfeaxepmtoomvbvbxgcbvucygplkql",97 "fqudtkzpoweczosdltursuiwzxapsoyitaltdgbadqphessrhnwxipcijtb"98 ],99 "output": "foycvolzkbafijihpaffpmbohpxekfwmrmjkqlyuinxdnxmvbnmgdjwzploaanuyvphvstsjypeejzmfsuqjafloycjwggqaefqudtkzpoweczosdltursuiwzxapsoyitaltdgbadqphessrhnwxipcijtbphyshjizrulnpjnhawppmbodqnfsndfatunrydrsnhplisxtfeaxepmtoomvbvbxgcbvucygplkql"100 }101 ],102 "haskell_template": "minimumString :: String -> String -> String -> String\nminimumString a b c ",103 "ocaml_template": "let minimumString (a: string) (b: string) (c: string) : string = ",104 "scala_template": "def minimumString(a: String,b: String,c: String): String = { \n \n}",105 "java_template": "public static String minimumString(String a, String b, String c) {\n\n}",106 "python_template": "class Solution(object):\n def minimumString(self, a, b, c):\n \"\"\"\n :type a: str\n :type b: str\n :type c: str\n :rtype: str\n \"\"\"\n "107}