var balancedStringSplit = function (s) {
let count = 0;
let ans = 0;
for (char of s) {
char === "R" ? count++ : count--;
count === 0 && ans++;
}
return ans;
};
Level
LeetCode Easy
Recruitment
var balancedStringSplit = function (s) {
let count = 0;
let ans = 0;
for (char of s) {
char === "R" ? count++ : count--;
count === 0 && ans++;
}
return ans;
};