Leetcode 742 Solution

This article provides solution to leetcode question 742 (to-lower-case)

https://leetcode.com/problems/to-lower-case

Solution

class Solution {
public:
    string toLowerCase(string str) {
        for (int i = 0; i < str.size(); i++)
        {
            if ('A' <= str[i] && str[i] <= 'Z')
                str[i] += 'a' - 'A';
        }

        return str;
    }
};