Verify and modify inorder subsequence | Airbnb Interview Question