Fun Greedy. My first thought was a DFS based solution... however the editorial provides a super neat 2-pass O(n) solution:
Pass 1: if s[l] != s[r], change the smaller one into the bigger one.
Pass 2: check k. if k > 0, we change as many chars into '9'
Split one convoluted problem into 2 easier one.