+ 11
How do I improve my code reading and math speed?
It has come to my attention due to challenges that I'm slow. The timer often runs out before I can answer. I'll give you examples in pseudo code so anyone can understand: a = string(length(string(4*100%2))*10) print a b = [1, 2, 5, 9] c = sum(sum(b), b[b[2]%2]) print c I never realized it because I work alone. I've only done *one* team project and the team was spread across the world so things were the same. But I'm serious about a coding career and this could impact on my interview or worse. Advice?
7 odpowiedzi
+ 19
Same here, i'll wait useful advices.
Btw, don't worry too much about it, there are lots programmers with many losses in challenges but with awesome codes. :)
+ 14
As said elsewhere the challenges aren't indicative of your abilities. Beyond the timer, they are often written to be convoluted. The example above I'd flat out delete from any program I worked on (and I am inclined to just comment things out by nature when fixing someone's code).
As for the interview case, they are looking more for how you think than worrying about speed (plus, the fact that people are nervous at the white board is a complicating factor. In my case, for one question I started and then erased my work 3 times for one question. After I finally got a head of steam, they stopped me and we discussed the multiple approaches I had considered and discarded (and why). It was a good discussion, even though it was rather uncomfortable to start.
I'm in week 3 of the job, btw.
+ 10
Challanges are not important.
Learn as much as you can and coding will become easy.
+ 10
It just need time to improve.
+ 6
I'm just leaving this here, because I have the same problem... But I guess the most effective way to improve anything is practice...
+ 5
It's not challenges I worry about, it's if I'm too slow in an interview :o
...
Been coding since 11 as a hobby so I'm fairly experienced. But I've only now found a language I like that I can make money with: Python. Problem is when I'm finished learning and ready for an interview, what happens when I'm too slow!? I'll be laughed out the building. Or if I get hired and am working in a team, will I get fired for slowing development down drastically? That's why I want to improve. I must.
+ 3
Many times you can save calculation time if you are smart.
In the first example you should see without calculation, that 4*100%2 is zero, because a product is even if and only if it has an even factor. (think about how this generalizes).
That the sum of b is 17 should also be clear at a glance. Rearrange the summands so you calculate (1+9)+(2+5). At least that is what I do subconsciously.
Beside these mental tricks, practice will certainly help you parse code faster and improve your "mental model" of that language, so you have more time to think more effectively about the code in front of you. Your general intelligence and working memory are probably fixed, so practice would be my suggestion for you. Don't use the challenges for that though, read some real code.
That being said, your speed in challenge questions is probably not indicative of your ability to solve less trivial problems (you know, the ones someone would pay you to work on) or your speed when tackling these, so don't sweat it.
Finally some concrete advice, that will help you at least in the Python challenges: Know your factorials and triangular numbers, there are way too many questions involving these. If you have a snippet of code, that looks like it is not just some random nonsense, try to see what it does and plug in the numbers later (like a primality test, gcd calculation, digit sum, conversion between number systems, etc...).