Compute shortest recursive string encoding | Snapchat Interview Question