Pergunta de entrevista da empresa OANDA

I can't recall the exact code, but it's a simple loop which has two variables inside it. One of the variables is auto-incremented, but under a certain condition the last increment is lost.