[RC Diary] Interview exercise (-42)
I find that being at a whiteboard completely changes my approach to the problem:
- at the laptop I am like, yeh ok let's code this thing with the first thing that comes into my mind
- at the whiteboard I am all like, uuhhhmmmmm, let's try this approach carefully and see what happens
I've spent most of the day going through this exercise, or better, through this last edge case of this exercise. Basically hackerrank.com runs your code against a set of tests, but it just tells you when you fail a test, without giving either inputs or outputs.
I tried various techniques during those hours to unstuck me, in no particular order:
- just code whatever idea comes to mind, usually delete it after 30' and up to the frustration
- stop looking at the problem watching youtube videos to try and leverage the background mind (hammock driven development)
- don't look at the laptop and try to word the problem in my own mind
- come up with examples about how the input might look
And I think this last one was the trick that unstuck me, usually for me the right solution is the one for which my brain says "Hey no, don't you overload me with that amount of thinking, let's just code away something good enough, eh? What do you think?". I've noticed this behaviour of my brain even during interviews, where it basically suggest me the easiest thing just to evade som hard work. It's a sensation difficult to fight, also because I'm mainly lazy, which sometimes could be a great thing, but not when you're trying to push through and get to the solution.