Microsoft interview question

the happy string leetcode question