What would the space efficiency of this solution be? Here is what I believe the time and space efficiency are. Please discuss/correct me if I am wrong.
Time: O(n)We are making a single pass through the characters of this string so the time complexity would be O(n) where n is the number of characters in the string.
Space: O(n)?My reasoning for thinking that space efficiency would be O(n) would be that we need to store the characters as an array in memory. This array would be n characters long so it would be O(n).
I'm pretty sure that time complexity is right but is the space complexity correct?