Microsoft Interview Question

LC medium questions, just keep practicing you will be fine.