Today's problem is to implement one of the most popular functions in programming languages, trim. The goal of trim is to remove whitespace from the beginning and end of a string. For bonus points you can make an ltrim and rtrim which remove whitespace only from the left and right respectively. While the worst case for your function should be O(n), you should include optimizations to not check every character if possible.
Anonymous - 7 years, 8 months ago