Simple Java Solution Greedy [Approximation Only, DP is the complete solution]
```\nimport java.util.*;\n\nclass Solution {\n  private Map.Entry maxOverlap(String a, String b) {\n    int len = Math.min(a.length(), b.length());\n    int max
```\nimport java.util.*;\n\nclass Solution {\n  private Map.Entry<Integer, String> maxOverlap(String a, String b) {\n    int len = Math.min(a.length(), b.length());\n    int max = -1;\n    String s = a + b;\n    for (int i = len; i > 0; i--) {\n      String right = b.substring(0, i);\n      if(a.endsWith(right)) {\n        max = right.length();\n        s = a + b.substring(max);\n        break;\n      }\n    }\n\n    for (int i = len; i > 0; i--) {\n      String right = a.substring(0, i);\n      if(b.endsWith(right)) {\n        if(right.length() > max) {\n          max = right.length();\n          s = b + a.substring(max);\n        }\n        break;\n      }\n    }\n    return new AbstractMap.SimpleEntry<>(max, s);\n  }\n\n  public String shortestSuperstring(String[] A) {\n    if(A.length == 1) return A[0];\n    List<String> list = new ArrayList<>();\n    Collections.addAll(list, A);\n    while(list.size() > 1) {\n      String s = list.get(0) + list.get(1);\n      int max = -1;\n      int l=0, r=1;\n      for (int i = 0; i < list.size(); i++) {\n        for (int j = i+1; j < list.size(); j++) {\n          String left = list.get(i);\n          String right = list.get(j);\n          Map.Entry<Integer, String> entry = maxOverlap(list.get(i), list.get(j));\n          if(entry.getKey() > max) {\n            max = entry.getKey();\n            s = entry.getValue();\n            l = i;\n            r = j;\n          }\n        }\n      }\n      list.remove(r);\n      list.remove(l);\n      list.add(s);\n    }\n    return list.get(0);\n  }\n}
[]