object Solution {
    def readBinaryWatch(turnedOn: Int): List[String] = {
        var ans = scala.collection.mutable.ArrayBuffer[String]()
        for(h <- 0 to 11;m <- 0 to 59){
            if(Integer.bitCount(h) + Integer.bitCount(m) == turnedOn) {
                ans += (h + ":" + (if(m<10) "0" else "")+m)
            }
        }
        ans.toList
    }
}

Q.E.D.