Meta Interview Question

Two medium-difficulty algorithms, the interviewer was very kind.