|
Oh man, I spent so much time on this, on and off for more than 16 hours.
But it was worth it in the end! Initially I didn't even noticed that there
is a "what to do" part in exercise file, so I started coding following my
own intuition, which wasn't too bad. I felt like I was going places and passed
a few tests but failed one or two test cases. That's when things started
getting difficult. I tried thinking, paper/pencil, sleeping on it, and reading
forums (coursera, edx has no discussion on this when I worked on it). I
then realized the "what to do" part in exercise and started following it.
I should have stashed my code based on my own intuition, but I didn't. I'm
learning, after all. Then my code got really messy. I added a lot of if
statements and temp variables to get by, but it consistently fails on grader
test case 20. That test case input is from a file, so far I haven't learned
proper way of reading file as input in junit, so I started simplify my code
hoping that I can pass. In the end my code simplification did work and passed
the grader, but I really should learn how to use file input in JUnit, or
how to feed input file. Eclipse makes that easy, but not IDEA, at least not
the version of 2018.2. 2018.3 supposedly has it, but I don't know how to
upgrade it safely on my Manjaro yet.
Woohoo, fun stuff!
|