Skip to content

Instantly share code, notes, and snippets.

@deleteman
Created January 13, 2023 17:44
Show Gist options
  • Save deleteman/a4e51f154bcc4c50b348c49c05b41305 to your computer and use it in GitHub Desktop.
Save deleteman/a4e51f154bcc4c50b348c49c05b41305 to your computer and use it in GitHub Desktop.
function getAllSortedSuffixes(w) {
let suffixes = []
for(let i = 0; i < w.length; i++) {
suffixes.push(w.slice(i))
}
return suffixes.sort()
}
let tree = {}
let root = "";
let suffixes = getAllSortedSuffixes(word)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment