The string to trim
The character to remove from the end of string
A string with the leading end
characters removed
Removes the trailing end
characters from an array.
Time complexity: O(n)
Space complexity: O(n)
A shallow-copied array with the trailing start
characters removed
Removes the trailing
end
characters from a string.Time complexity: O(n)
Space complexity: O(n)