ByteDance interview question

String manipulation and graph questions