Flip-Game

This is another easy LC problem with easy solution.

class Solution {
    fun generatePossibleNextMoves(s: String): List<String> {
        val output = ArrayList<String>()
        var ctr = 0
        while(ctr <= s.length - 2){
            var sub = s.substring(ctr)
            if(sub.startsWith("++")){                
                sub = s.substring(0 until ctr) + sub.replaceFirst("++", "--")
                output.add(sub)                      
            }
            
            ctr++
        }
        
        return output
    }
}
Runtime: 184 ms, faster than 33.33% of Kotlin online submissions for Flip Game.
Memory Usage: 36 MB, less than 100.00% of Kotlin online submissions for Flip Game.