Rust translated DP solution
rust\nimpl Solution {\n    pub fn shortest_superstring(words: Vec<String>) -> String {\n        let n = words.len();\n        let mut graph = vec![vec![0; n]; n
```rust\nimpl Solution {\n    pub fn shortest_superstring(words: Vec<String>) -> String {\n        let n = words.len();\n        let mut graph = vec![vec![0; n]; n];\n        for i in 0..n {\n            for j in 0..n {\n                if i != j {\n                    let mut k = words[j].len();\n                    while !words[i].ends_with(&words[j][..k]) {\n                        k -= 1;\n                    }\n                    graph[i][j] = k;\n                }\n            }\n        }\n        let mut dp = vec![vec![0; n]; 1 << n];\n        let mut parent = vec![vec![None; n]; 1 << n];\n        for mask in 0..1 << n {\n            for b in 0..n {\n                if mask >> b & 1 == 0 {\n                    continue;\n                }\n                let prev = mask ^ 1 << b;\n                for (i, row) in graph.iter().enumerate() {\n                    if prev >> i & 1 == 0 {\n                        continue;\n                    }\n                    let val = dp[prev][i] + row[b];\n                    if val > dp[mask][b] {\n                        dp[mask][b] = val;\n                        parent[mask][b] = Some(i);\n                    }\n                }\n            }\n        }\n        let mut mask = (1 << n) - 1;\n        let mut perm = Vec::with_capacity(n);\n        let mut seen = vec![false; n];\n        if let Some(mut p) = (0..n).max_by_key(|&i| dp[(1 << n) - 1][i]) {\n            loop {\n                perm.push(p);\n                seen[p] = true;\n                if let Some(t) = parent[mask][p] {\n                    mask ^= 1 << p;\n                    p = t;\n                } else {\n                    break;\n                }\n            }\n        }\n        perm.extend((0..n).filter(|&i| !seen[i]));\n        (1..perm.len())\n            .rev()\n            .fold(words[perm[n - 1]].clone(), |acc, i| {\n                let overlap = graph[perm[i]][perm[i - 1]];\n                acc + &words[perm[i - 1]][overlap..]\n            })\n    }\n}\n```
['Rust']