Skip to content

Latest commit

 

History

History
5 lines (5 loc) · 552 Bytes

README.md

File metadata and controls

5 lines (5 loc) · 552 Bytes

shortenString

Design an algorithm which shortens a string into a shorter string. Write this function in JS.

  1. It is given that input strings are alphabets only and provided in small case only (for eg starwars). This should get shortened to something smaller (output can be alphanumeric)
  2. The shortening algorithm should be non-conflicting, i.e. no 2 different input strings should result in same shortened output string.
  3. Also write the reverse operation, if I enter a shortened string, it can decode and provide the original full string.