I'm new here. Does my resulting data structure have to exactly mirror the solution sample provided?

ie [ ["aa", "b"], ["a", "a", "b"] ]

one way to solve would be to have a substring size -> n and walk through finding which substrings of size n are palindromes, then incrementing n. this is possibly expensive and naive. this is my first try.

But one of the vectors has two palindromes of different lenght.

Any ideas?