H&R Block interview question

Simple two pointer and another LC medium question on string