Motorola Solutions Interview Question

string arrangements, code optimization and review