Odin-'s blog

By Odin-, 8 years ago, In English

What are the greatest programming tips and tricks you have learned on your own by years of coding? ****

For me, These are the most important tips I can really think of.

1) Keep it simple.

Spend a while planning ahead to save countless hours of frustration, headaches and failure.

2) TEST in every sub-problem your code solves.

I think this tip is for non professional coders such as myself, because when you move on to the next sub-problem you save your self the time of rereading what you have checked before (you check the last part of code to detect the bug in your code). Trust me this doesn't take much time just 50 seconds after each sub-problem.

3) Readability is more important than most believe.

When you learn to write simple readable code, you can code faster. The bugs will not occur as a messy code and if a bug occurs it will be faster to detect it and fix it.

Please share your experience, and correct me if I am wrong!

  • Vote: I like it
  • +81
  • Vote: I do not like it

| Write comment?
»
8 years ago, # |
  Vote: I like it -67 Vote: I do not like it

Poor tips ): I code and submit with out even compiling and get Ac.

  • »
    »
    14 months ago, # ^ |
      Vote: I like it -25 Vote: I do not like it

    this is not poor tips, this is pro tips

    • »
      »
      »
      14 months ago, # ^ |
        Vote: I like it -9 Vote: I do not like it

      Please don't necropost. I can see the downvotes coming to both your and my comment.

      This is just a joke made 7 years ago. Don't take everything serious.

      btw is it rated?

»
8 years ago, # |
Rev. 7   Vote: I like it +35 Vote: I do not like it
  1. Forget about codes, you will just make it harder to think out of the box

  2. Solve the simplest instance of the problem you're working on before moving to the actual problem

  3. Brain storming surely has its benefits, let's stress-test that pinky organ

  4. You need to get your hands dirty, and I mean it

  5. Keep improving your code, try every possible approach and technique you can think of and compare between them

  6. Premature optimizations are the root of all evil, it's no joke

  7. Enjoy the problem statement, for it was written to keep you entertained

  8. Aim not too high it feels unreachable, take it step by step

  9. Ask nobody for help, you grow wings and feel enlightened and a lot more of this sort

The last part is debatable and not for everyone

  • »
    »
    8 years ago, # ^ |
    Rev. 2   Vote: I like it +9 Vote: I do not like it

    Ask nobody for help, you grow wings and feel enlightened and a lot more of this sort

    Would you say I would be... enlightened by my own intelligence?

»
8 years ago, # |
  Vote: I like it +15 Vote: I do not like it

Error = ( More_ Code ) ²

»
8 years ago, # |
  Vote: I like it +11 Vote: I do not like it
  • Stay cool at the contest time if you don't get the AC although the problem is easy to solve. You can be angry after the contest time, but when you get you mind hot during the contest, surely You won't be able to solve other problems easily/quickly. Keeping the brain cool is the great thing :D

  • Get anger but Don't get depressed! It eats your confident! where the confident is the most valuable thing in programming + every step of life.

  • Don't give up!

  • Try to help people! that takes your thinking and debugging level higher :)

[ Although I'm a new learner! But I've learned those things :D I've some more to write also but can't remember! :( poor me! ]

»
8 years ago, # |
  Vote: I like it +123 Vote: I do not like it

Just squeeze brutes.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I did not understand what is that suppose to mean??? I am serious!

»
8 years ago, # |
  Vote: I like it -55 Vote: I do not like it
  1. Google "[competitive] programming tips and tricks [for beginners]".
  2. Profit.
  • »
    »
    8 years ago, # ^ |
      Vote: I like it +13 Vote: I do not like it
    1. Google "[competitive] programming tips and tricks [for beginners]".
    2. Follow the result link to this blog.
    3. Read this comment.
    4. Go To 1.
    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it -13 Vote: I do not like it

      There are four ways to write that. It's surprising that all of them result in a link to this blog. It's even more surprising that there are no more results — I would guess that this question was asked hundreds of times.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +7 Vote: I do not like it

      I Couldn't find the blog, plz give me the link

»
8 years ago, # |
  Vote: I like it +3 Vote: I do not like it

1.Keep going. 2.Repeat step 1.

»
8 years ago, # |
  Vote: I like it -16 Vote: I do not like it
  1. Don't even try to prove your guesses. They are probably right, so you'll just waste your time you could've spent on debugging (since noone actually takes time to think the code through before writing it during constests).
  2. No matter the input size, your solution should be O(n log n).
  3. No matter the asymptotics, your constant is probably way too high to pass coughs some SPOJ problems coughs.
»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Practice makes perfect.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Practice, and most important reading tutorials when you are stuck and can not solve hard problem.

»
8 years ago, # |
  Vote: I like it +16 Vote: I do not like it
  • Upsolving the contest is more important than the contest itself
  • Missing contests won't make you stronger
  • Many problems are similar to each other
  • If you want to be successful in Codeforces — solve Codeforces problems archive
»
8 years ago, # |
  Vote: I like it +50 Vote: I do not like it

I used to spend most of my time thinking about stuff like this and giving myself tips, never shared them though. This is kind of personal and worked for me.

  1. Learning: Read a topic, understand it (if you don't, then read it as many times as it takes) and then solve problems about that topic (10-20), now you should be good at that type of problems, or at be good at identifying them when you see them.

  2. Compete: Try to solve as many problems as you can during competition and try to push yourself to the limit, you have to understand that you come with limitations, the only way you can get better or improve yourself is to break those limits and the best way to do that is to push yourself to your limit. Once the contest is over upsolve 1-3 problems (1-2 for 2 hr contests and 3 for 5 hour contests). This will help you push your limits, because if you only solve problems during the contest you will either stay the same or increase your level very slowly.

  3. When not learning or competing: If you are not learning a new topic or feel like competing them you can probably submit random problems in any OJ or just solve them and not code them. I liked to open a random ACM ICPC contest and just read the problems and think about solutions and their complexities and try to demonstrate they would work but most of the time I didn't implement them, especially the easier ones, only the ones that sounded interesting of challenging, also if I found a problem I couldn't solve after hours I would look for the editorial and potentially discover a new topic to learn, doing this also helped to expand my mind in how to solve problems.

  4. Body: I know this sounds not important, but remember your mind is part of your body, and if you want to do well you need to be in good shape, so eat well, a balanced diet always help, but don't eat just for eating, and sleep good, I slept 8-10 hours per day. If you feel physically exhausted you might need to take a break. Also try to find time every day for yourself where you can think about how things are going and how you are doing, use this time for personal stuff as well, you have a life when you are not programming. Doing this will help you focus during contests.

  5. Enjoy: The first 4 points might sound too intense, so remember that you need to enjoy life, go out with friends, talk with people, do a hobby you like, go walk somewhere.

»
14 months ago, # |
  Vote: I like it +3 Vote: I do not like it

my advice to give :- Don't be shy to ask anyone for help

i think all pro competitive programmer needed help and asked for help one day.