/ibm-shortestsubstring

Project created for an IBM application. It returns the smallest substring that contains all the letters in a string.

Primary LanguageJava

IBM application test

This small application iterates given string to find the shortest substring that contains all characters within itself.

  • Input: a string that will be iterated and processed.
  • Output: the given string, the substring found and its length.

Examples

  • daabcbcbdc: The first shortest substring in "daabcbcbdc" is "daabc", and its length is 5
  • aabcbcbdca: The first shortest substring in "aabcbcbdca" is "bdca", and its length is 4
  • aaaae: The first shortest substring in "aaaae" is "ae", and its length is 2
  • argh: argh.