Ad
  • Custom User Avatar

    Is it actually BP to write this outside of the class declaration?

  • Custom User Avatar

    Is that canned?

    LOL. No.

    I hope I didn't take too much of your time. If so, how can I pay you.

    Good questions are welcome any time -- answers are free. You can pay me by following my C solutions and upvoting whatever you like, by asking more interesting questions, and by telling me any bugs you find.

    Cheers.

  • Custom User Avatar

    Thanks for such a great response. Is that canned? I hope I didn't take too much of your time. If so, how can I pay you.

    And I'm still trying to solve problems like you but it'll take some time

  • Custom User Avatar

    Ok, how do you always come to concise, simple solutions and what is your thought process behind achieving simple solutions?

    Here are a few strategies I use:

    1. Just stick to simple problems --- Firstly, my "simple" solutions are only for Kyu 8,7,6,5. So I am only doing the easier puzzles in the first place. I am too lazy these days to ways to spend days to solve something.

    2. Be confident! --- IMO it is not uncommon for simple problems to have simple solutions, so just convince yourself that you are going to find what it is if you just take time to think about it, instead of bashing out the first code that springs to mind.

    3. Iterative Process --- Arriving at a good solution is much more iterative than you may think. The better ones might be my 3rd or 4th submission, and I often fork my own soultions to improve them... sometimes even years after the original.

    4. Stand on others' shoulders --- Often I get some clues off the other people's solutions. e.g. Person A has one good idea, Person B has another good idea. Then I will try to figure some way of combining the best parts of both A and B create something new that is better than either of them.

    5. Deliberately use code that looks like magic --- For C Programming (my favourite) I gravitate towards things like pointers and bit-fiddling and recursion. I've been writing C code long enough that it is not hard anymore but I know it sometimes looks like magic. e.g. I will always use pointers to traverse an array instead of using an index variable. Why? Just because.

    6. Avoid the overly mathy Kata --- IMO those Kata generally rely on some special clever trick that only a maths student would know, so for those user the Kata is easy and concise, but others would struggle. I am in the "others" group.

    7. Practice Practice Practice --- Playing code-golf with a few other CW users here is a fun way to keep from getting rusty and learning cute new tricks.

    8. Learn from others --- After submitting your solutions definitely take time to look through several pages of other solutions. See if you can learn techniques that other people used.

    9. KISS --- Actually, concise simple solutions is my solution goal from the outset. Of course, many Kata solution might be easily written verbosely or with multiple loops etc, but I don't start that way because I know 100s of other people will post those kind of solutions anyway. So I deliberately start out from the POV of "what can I do here that is really left-field that nobody else is likely to do"?

    10. Don't kid yourself - Although I lean towards aiming for "clever", instead of "best practice" solutions, don't kid yourself they are the same thing. Mostly they are not. Many of my "concise, simple" solutions are cute but they are also just plain silly rubbish code and not production-quality.

    Note that I don't think this solution is that easy to read, but I've seen alot of your other answers

    I agree. I am pleased you recognize this is not one of my better ones.. :-(

  • Custom User Avatar

    Ok, how do you always come to concise, simple solutions and what is your thought process behind achieving simple solutions?

    :D

    Willing to pay a lot if you think you can actually quantify that

    Note that I don't think this solution is that easy to read, but I've seen alot of your other answers

  • Custom User Avatar

    No, but if you ask me a question I will try to answer it.

  • Custom User Avatar

    Do you do any coaching dinglemouse?

  • Custom User Avatar

    That's because the old-school, pre-ANSI, K & R C style function declarations format, that I learned before you were born, is still supported ;-)

    https://stackoverflow.com/questions/22500/what-are-the-major-differences-between-ansi-c-and-kr-c

  • Custom User Avatar

    How are you allowed to not specify types in your function declarations?

  • Custom User Avatar

    I disagree.
    Unless the solution is ridiculously hard to achieve with an algorithm, hard coding only leaves you completely inflexible to any future requirement changes.