My problem is to create suffix array for a given string.
So far I've taken the tails of the string paired them with indexes and sorted them by strings.
I need to drop the string part of the tuple so I can return Seq[Int]
, but I don't know how to do that.
This is what I tried to do:
def suffixArray(s: String): Seq[Int] = s.tails.zipWithIndex.toSeq.sortBy(_._1)