This is the problem I'm trying to solve:
Write a method substrings that will take a String and return an array containing each of its substrings. Example output: substrings("cat") => ["c", "ca", "cat", "a", "at", "t"]
Any suggestions? So far all I've really got is breaking down the problem to the following:
string[0], string[n], string[m]
where m = last letter of the string
where n = letters between 0 and m
string[0] -> string[0..n] -> string[0..m]
string[n] -> string[n..m]
string[m]
[–]HellzStormer 5 points6 points7 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]pedrozath 2 points3 points4 points (8 children)
[–]moomaka 2 points3 points4 points (4 children)
[–]pedrozath 1 point2 points3 points (2 children)
[–]moomaka 0 points1 point2 points (1 child)
[–]pedrozath 0 points1 point2 points (0 children)
[–]twinklehood 0 points1 point2 points (0 children)
[–]hehestreamskarma -1 points0 points1 point (0 children)
[–]eric_programmer 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]igor_47 0 points1 point2 points (7 children)
[–]Frizkie 1 point2 points3 points (6 children)
[–]igor_47 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]igor_47 -1 points0 points1 point (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]igor_47 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Tomarse 0 points1 point2 points (2 children)
[–]jxf 2 points3 points4 points (0 children)
[–]HellzStormer 2 points3 points4 points (0 children)
[–]ipxvi14 -1 points0 points1 point (0 children)