3019. Number of Changing Keys 發表於 2024-01-28 | 分類於 leetcode problemsolution12345678910111213class Solution {public: int countKeyChanges(string s) { int count=0; int n = s.size(); for(int i=1;i<n;++i) { count+=(tolower(s[i-1]) !=tolower(s[i])); } return count; }}; analysis time complexity O(n) space complexity O(1)