“Stretching beyond your limits without over-stressing yourself”, a task I pondered upon when preparing for A2 exams and university applications last year. Here’s the classical responses:

“It’s fine as long as you don’t go beyond elastic limit” (Zhi Khang)
“Trying something new is considered stretching beyond your limits yet wouldn’t hurt you” (Carin)
“Are you talking to a rubber band?! :O ” (Jean)

The whole feel came to me again right now–one year after I wrote this.

Suffices to say, the main part of it is because I am venturing into CS 145, the so called advanced first term computer science course. I can’t tell how hard it is compared to the normal CS classes, but the time consumption is real: the recent assignments just morphed themselves into a marathon.

What explains that?

The finding of efficient algorithms and debugging. Depressed, when the judging site displayed “wrong answer” repeatedly despite every effort to troubleshoot, yet couldn’t prevent contract error from invading frequently. Sometimes I am amused that determining whether to assign (second of first of x), (first of second of x) or (the remaining of first of x) can take me hours to figure out (x=nested list).

When a subtle thinking error took me an afternoon to figure out
When a subtle thinking error took me an afternoon to figure out

It’s great idea to test programs offline before submission, but at one point I am too strained to do every testing and submitted my code once I thought it as “working well”, resulting in smeared record:

Never did 9 submissions on the same problem before :(
Never did 9 submissions on the same problem before 😦

This isn’t new. Back then, coding in C++ gave me enough trouble when there were edge cases that I never fully consider of. Here’s a problem that took me 4 hours to discover that my code got into the abysmal of infinite loop:


(The problem has a grid as a setting, with each square given direction to move to one of four directions. We are to find the number of squares that can be used as a starting point to get to the target square eventually).

Here’s my solution:

Page 1
Page 1
Page 2

Another example: I tried to think over this problem, break it into sub-problems and construct the solution to each of them meticulously (basically, finding the gcd and inverse). After days of thought, done were the problem and I threw it into the submission machine, only to witness my frustration come live when the judging server jeered “wrong answer at test 8” repeatedly.

I searched for my composure, trying to see some borderline cases and noticed an error, and it took me just an extra line to eliminate this superbug.


Finally another submission that’s too crazy to mention:


They shared a common feature, however: my submission passed, eventually. Did it always happen? No–I wrote a contest without having any submission accepted, only to realize that a very subtle case was forgotten. But I believe that working insanely hard towards code acceptance was what programmers are looking for, and it’s worth the effort. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s