fragments. Build the shortest string that contains every fragment as a substring (a contiguous piece).
No fragment is a substring of another, and all fragments are distinct. The shortest such string is guaranteed to be unique. Return it.fragments=["gatt", "ttaca", "acag"] → 'gattacag'
"gatt" and "ttaca" overlap on "tt", giving "gattaca"; then "acag" overlaps it on "aca", for "gattacag", 8 letters.
fragments=["cde", "abc"] → 'abcde'
"abc" then "cde" share the "c" and give "abcde". The other order has no overlap and would take 6 letters.
fragments=["hello"] → 'hello'
fragments=["gatt", "ttaca", "acag"]
'gattacag'
Run checks the first 3 tests in your browser. Submit checks all 34 tests on the server, hidden ones included.