💢☠💫Easiest👾Faster✅💯 Lesser🧠 🎯 C++✅Python3🐍✅Java✅C✅Python🐍✅C#✅💥🔥💫Explained☠💥🔥 Beats 100
Intuition\n\n Describe your first thoughts on how to solve this problem. \n- JavaScript Code --> https://leetcode.com/problems/consecutive-characters/submission
# Intuition\n![0ehh83fsnh811.jpg](https://assets.leetcode.com/users/images/966cc9ff-60a8-45b0-86df-a792241eab1a_1725356745.7222025.jpeg)\n<!-- Describe your first thoughts on how to solve this problem. -->\n- ***JavaScript Code -->*** https://leetcode.com/problems/consecutive-characters/submissions/1377518875\n- ***C++ Code -->*** https://leetcode.com/problems/consecutive-characters/submissions/1377391724\n- ***Python3 Code -->*** https://leetcode.com/problems/consecutive-characters/submissions/1377471507\n- ***Java Code -->*** https://leetcode.com/problems/consecutive-characters/submissions/1377466619\n- ***C Code -->*** https://leetcode.com/problems/consecutive-characters/submissions/1377490145\n- ***Python Code -->*** https://leetcode.com/problems/consecutive-characters/submissions/1377469342\n- ***C# Code -->*** https://leetcode.com/problems/consecutive-characters/submissions/1377501664\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n      O(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n      O(1)\n# Code\n```javascript []\n/**\n * @param {string} s\n * @return {number}\n */\nvar maxPower = function (s) {\n    var maclen = 0, currlen = 0\n    let curr_ch = \'\\0\'\n    for (let ch of s) {\n        if (ch == curr_ch)\n            currlen++\n        else {\n            curr_ch = ch\n            currlen = 1\n        }\n        maclen = Math.max(maclen, currlen)\n    }\n    return maclen\n};\n```\n![th.jpeg](https://assets.leetcode.com/users/images/4826a03c-2f30-4322-9665-e57a0499369b_1725357445.7444794.jpeg)\n
['String', 'C', 'Python', 'C++', 'Java', 'Python3', 'JavaScript', 'C#']