News for hackers. Stuff that matters.
Re:Two problems I had to solve in my Oxford interview (2013) by elevensies on Monday May 11, 2015 @11:25PM (#9529415)
Couple corrections I think: - Register 4 should be set to zero before incrementing in instruction 2.

- inst. 4 should compare 0,4 , register 1 is unknown at this pt.

- inst. 3 should jump to 5

Re:Two problems I had to solve in my Oxford interview (2013) by joshvm on Tuesday May 12, 2015 @01:00AM (#9529688)
Yep 3->5 is a typo.

r4 could be zeroed, but I was lazy and assumed that as long as it's greater than zero it doesn't matter (since it's always compared to zero).

Instruction 4 should be cmp(3,4) to force a jump to 9.

EDIT: Although thinking about it, it doesn't make much difference. It has the same effect as doing cmp(0,4) since you know r4 > 0 and r0 == 0.

Thanks!