So I spent one whole weekend + most of the new year holidays to solve foobar problems. The last one (level 5) was the hardest – it took me almost three days but I made it. Anyway, that was fun.
One thing I regret is that I should have prepared the real development environment earlier. Up to Level 3, I was just using the foobar system’s editor and verification system directly because I don’t use java and I didn’t want to bother to install JDK on my mac. It was kind of ok doing this way up to Level 3 but in Level 4, the problems got much more difficult and I was just repeating verification many times until I passed. At this time, I was using online java console where you can run java code on the web browser but it was still cumbersome. Anyway, I wasted a lot of time there fiddling with the code with no debugging system.
In Level 5, after reading the problem I realized I really needed to prepare the decent dev env, so I installed JDK, created a git repository, confirmed inline debugger works with Visual Studio code and established my own testing/verification system. This way, I could concentrate on the algorithm design and coding pretty well. After passing my own verification running on my pc, I copied my code to foobar verification system. The verification passed on the first try!