S
S
summeranimation2016-07-12 05:14:22
JavaScript
summeranimation, 2016-07-12 05:14:22

How to approach solving non-trivial problems?

Hello!
For practice in JS, I found the Codewars resource quite interesting. Quite often I went there and solved problems by profile level, at first it seemed that they were all quite simple and I spent a maximum of 20 minutes on solving the problem ... until I started solving problems of rank 3 kyu. The only things I can solve from 3 kyu without spending a whole day are tasks that miraculously were so highly rated, for example, the field validator for playing a sea battle , everything else is hardcore for me, at first I don’t even know in which direction move, often the first idea that comes to mind is far from the best (and not rarely non-working) idea, and when, after submitting the solution, I look at the solutions of others, I feel ashamed of my code...
Can you recommend literature on the topic, or is it better to just practice further and it will become easier over time?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Nizhny Novgorod, 2016-07-12
@Terras

Hello.
I always use the pain model:
1) You look at the problem
2) You try to solve it
3) You understand that you are a stupid idiot who can't do anything.
4) You raise Google to help
5) You raise literature to help
6) You ask the guys on the topic: "why this and not otherwise."
7) You complete the task, realizing that you are stupid, since you had to spend so much time on solving this task.
Repeat to infinity and you'll be a pro.

A
Andrew, 2016-07-21
@iCoderXXI

I indulge myself there as much as I have free time, strength and desire, purely to stretch my brains, tk. I participated in the Olympiads for a long time, the last time was already in 1998. Proof: https://www.codewars.com/users/iCoderXXI
It's not always possible for me to immediately understand what the author of the problem wants, I have to re-read it ten or twenty times, to delve into it, in principle, as in real combat missions in life. I always try to build in my head a working model of the process, so to speak in dynamics, incoming and outgoing signals (data), logic, algorithms.
I solve iteratively, trying to pass the tests. Often there are borderline cases that do not immediately become obvious and often at first you don’t think in that direction, here what is called at least started up at all, and not that it flew away. then you finish the solution iteratively for each failed test.
Some of the tasks are encountered that have never been solved before. If it is not clear what it is about, then I google the essence of the problem. I try to avoid looking into solutions, if they are found somewhere, it is important for me to decide on my own, even if not so ideal and beautiful.
When I look at the decisions of other fighters, I often see overcomplicated, ostentatious decisions. If a fighter in my team began to write such code, then he would definitely leave to solve individual problems, because it is very difficult to read and understand such a thing. I myself try to write compromise code, on the one hand, quite effective, on the other hand, understandable even to a beginner.
In general, my core, as a programmer, was formed under conditions of severe restrictions, which is worth only a 64 kb memory limit for pascal variables. Of course, I did not endure this mockery for a long time, and quickly figured out pointers, a heap, data structures, so that my programs had access to up to a megabyte or more for data, although of course the logic became very ornate.
Somewhere even the code of the hypertext compiler and viewer, which I wrote in 1997 on the order of a lawyer, has been preserved. Now nobody needs it, because. there are all sorts of Consultant +, but at that time I think it was a very interesting product. For those who are interested, here is a link to the github https://github.com/iCoderXXI/hypertext

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question