Trick behind people solving problems in just 10-15 minutes is easy and difficult at the same time. To solve problem you need two things:
a) figure out how to solve the problem b) to code up solution as fast as possible. (b) part is easier - you just need to train implementing solutions as fast as possible. Also you need to think for the ways you can speed up writing your own code. For myself there are some "tricks" which help. I'll just give a few: - fast blind typing is important but probably least important on the list. Still if you can't do it - this is something you need to learn not only for programming. - figuring out the clearest way to do something. very important - you know what your piece of code needs to achieve. You can program it with nitty-witty one-liner which is very cool. Or you can assign bunch of local variables and slowly step by step implement it. Generally second approach wins - you save a lot debugging, speed wins of first approach tend to be irrelevant. General advice - do not make too complicated code. Write as simple as possible within requirements of algorithm. - use pen and paper. The most important thing when I can't do without pan and paper is when you program something with indices "travelling" through array - it is so easy to make mistake with going one step to far or stopping one step short of - that I prefer to draw nice picture and more arrows together with writing code. Also I always use pen and paper when writing messy DP solutions (like Garbled Email last year). - important - if you understood how to solve problem, but implementing your solution was like hell - with lots of bugs and you've spent 5 hours before it finally worked on small input and another 5 hours for large - people tend to be happy about finishing it, then shrug it off saying "I did it". I would say "No, you didn't. Take a break for 10-15 days, then open same problem again and implement solution once more.". In many cases you again spend hours doing it - then try again sometime. If you know solution, you must be able to code it in half an hour at most. (a) this is the difficult part. Solutions to problems usually come in "clicks". It's your subconscious applies all problems you did before and knowledge it thinks relevant to new situation. When it finds something similar - it clicks. And you see solution. Sometimes it is wrong. The more experience you have the faster it comes. You can do step-by-step process trying to apply different programming technics to each problem, but it doesn't always work, especially with Codejam - their problems are more based on insight then programming technics. To be able to solve it fast you need more and more practice. I would say that practice is even more important then reading books on specific topic. Hope this helps. -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/d7e83428-8b82-4e7e-8b91-8d83f1d980a2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
