a couple of interview problems - intermediate commit