X Interview Question

LC Easy/medium array problem and some string manipulation