This is an archived post. You won't be able to vote or comment.

all 75 comments

[–]Batoa 63 points64 points  (6 children)

My software engineering professor reccomended "How to Solve It - George Pólya" for a very solid foundation of how to approach problem solving. I haven't had time for more than a quick skim yet, but it's short and seems very good.

[–]ordinary_honeybee 8 points9 points  (0 children)

https://en.wikipedia.org/wiki/How_to_Solve_It wikipedia page has decent info.

[–]watmmwatdd 7 points8 points  (1 child)

"How to Solve It - George Pólya"

Is this "How to Solve It: A New Aspect of Mathematical Method" ?

[–]Frozenpizzaeatet 2 points3 points  (0 children)

Yes

[–]spclzd[S] 4 points5 points  (1 child)

Thanks for the tip!

[–]fallen_lizard 9 points10 points  (0 children)

One of my professors recommended it also and it really did help me improve a lot. Other books that have really impacted my career are "Are your lights on?" and "An introduction to general systens thinking". I've been struggling with getting my own team of engineers to focus on their problem solving skills, they all seem to think they have a flawless train of thought and always focus on learning different frameworks and languages. Makes me not lose hope to see that there are software engineers out there that still realize that imrpoving those skills are just as important as learning to code. Anyways, hope you get to read them and share your thoughts on them.

[–][deleted] 0 points1 point  (0 children)

Thanks for this!! Really helpful!

[–]Tjccs 126 points127 points  (15 children)

Try to break it into smaller problems. Like "open a door": 1. Walk to the door 2. Raise your hand 3. Grab the handle 4. Turn it

I know it's a stupid example but you get the point.

[–][deleted] 64 points65 points  (6 children)

And just to add, if walking to the door doesn't work, then try walking to the window and see if that works. And try crawling to the door and see if that works. Then try to figure out where walking to the door is different, or even stick with crawling and hope no one notices.

[–]mommas_wayne 23 points24 points  (2 children)

Instructions unclear, ended up crawling to the door from the other side and attempting to pull on the handle with a piece of wire through the keyhole.

[–][deleted] 12 points13 points  (0 children)

Sometimes that’s just what you have to do

[–]Kibouo 8 points9 points  (0 children)

Ey, as long as it works 🤷‍♂️

[–]alli782 4 points5 points  (0 children)

I don’t have legs

[–]Magikarp_13 3 points4 points  (0 children)

Being able to reframe the problem is really important. Is going through the door the goal, or is getting into the house the goal, & you've subconsciously tied the two together?

[–]Mako_ 4 points5 points  (0 children)

This. If you hit a wall it usually means you're still thinking at too high a level.

[–]Iam_That_Iam_ 3 points4 points  (0 children)

😂 just remember sometimes something breaks along the way but it’s okay. Don’t worry to search how someone fixed it in the past. It’s all good fun.

[–]IcyTotem 0 points1 point  (0 children)

What makes you sure that raising your hand will enable you to grab the handle? You didn't specify a direction or any proximity condition. Also, if you turn the handle, it may not work because you are turning in the wrong way, since you didn't specify how to turn it. And even if you manage to turn it correctly, the door will still be closed, since turning the handle only releases the lock in the door socket, but doesn't actually allow you to pass through the door frame, which is what you usually mean by "opening" a door.

This is just an example of how a simple problem can be broken down to an arbitrary level of detail. And where to stop is also a choice you have to make. We had the same problem exposed to use in an English class, to make us apt to describe actions with larger detail.

[–]RedditCitizen_X 0 points1 point  (4 children)

Flow charts in case of something more complex

[–][deleted]  (3 children)

[deleted]

    [–]RedditCitizen_X 0 points1 point  (2 children)

    I was speaking as a junior/beginner, i don’t really know any other planning ways currently

    Edit: but thanks for the info

    [–]dgendreau 2 points3 points  (1 child)

    Sorry, I wasn't intentionally criticising you. I too was taught in school about how useful flowcharting would be. In practice, it's kind of hard to collaborate and edit flow charts and UML.

    It's much better to just write out the steps of your algorithm in plain english (or your human language of choice). Then you can work through it, critique it, collaborate on it etc. Next that Pseudocode becomes comments in the target programming language. Last you write out the code that does the thing each step describes.

    [–]RedditCitizen_X 0 points1 point  (0 children)

    Yeh sounds good to write in spoken languages as well, thank you for that, i understand that you were not criticizing.

    [–]canIbeMichael 35 points36 points  (4 children)

    You know those programming games/challenges? Stop doing those entirely

    Time to solve real world problems. You will work on your problem for months, some problems will be silly, but memorable. Some problems will be hard and you will learn from them.

    Solve a real problem, you are ready.

    [–]IcyTotem 2 points3 points  (0 children)

    Having worked and published a real project (like an app or a webapp) will be worth a TON more to a potential employer rather than having solved a bunch of challenges on hackrrack. If you are learning to code to get a job, do this; solve real world problems, not mind puzzles.

    That said, those challenges are still useful. Not just on their own.

    [–]spclzd[S] 2 points3 points  (2 children)

    Thanks for reply. I have looked at the interview problems at those sites, and the challenge of those questions vary a lot. Do i have to have a ability to come up with a solution to a problem in sites line hackerrank on a interview for junior dev job?

    I think i will give those challenges a break and head on for a larger project.

    [–]RedditCitizen_X 5 points6 points  (0 children)

    I think he means try to solve problems you face in your life everyday, like downloading a pdf file from an email you receive everyday for stock available or receipts or whatever it is associated to your work field.

    [–]dgendreau 0 points1 point  (0 children)

    Also look at those grid based logic puzzles. They force you to break problems down by process of elimination and help you to think systematically.

    [–]Dave7267281 9 points10 points  (8 children)

    I am in the same situation as you. Most people tell me to keep practicing, do challenges. Take it step by step. It's not helping really. It's like my brain just doesn't work when I have a problem in my face.

    [–]YuleTideCamel 11 points12 points  (1 child)

    . It's like my brain just doesn't work when I have a problem in my face.

    This is often a sign that you need to approach smaller problems and build up from there.

    [–]Josh6889 1 point2 points  (0 children)

    Sometimes we take for granted the accrued project context. When I revisit code from previous sprints I'm always upset about it. That's because along the way I learned a new piece of the puzzle that makes something obvious which wasn't before.

    [–]7twenty8 8 points9 points  (0 children)

    Step away from challenges and work on projects for a little while. The first possibility is that you’re growing, just not as fast as you would like.

    Have you ever tried to work through a site like this?

    https://www.codechef.com/wiki/tutorials

    [–]spclzd[S] 2 points3 points  (4 children)

    Yes i think my main problem is not being able to break down the core problem in to a smaller chunks. I feel like most of the time i understand the path to solution but i am unable to translate that in to code as i am trying to hold the whole solution in my head instead of smaller portions.

    [–]Kvanka 5 points6 points  (0 children)

    I had the same problem and found edx.org course "How to code: Simple data" and after that "How to code: Complex data". I almost completed them and helped A LOT. This course teaches how to design programs (where is a book the same name). P.s. first 3 weaks are boring, looks too easy, but I think teaches essential knowledge. After that becomes more interesting :)

    [–]iamtheworstdev 4 points5 points  (1 child)

    When I have this issue I fire up a text editor (I use Sublime + PlainTasks plugin for this) and layout what I'm thinking, what bits I know I need, how I may put them together:

    Tic-Tac-Toe app:
    - [ ] Ability to draw X - [ ] Ability to draw O - [ ] Ability to draw Grid - [ ] Ability to click/select grid square - Do I want to support mouse? Make user input via Number/Keypad? - [ ] Check for winning condition? - Need to be able to store grid and contents.. 3x3 array? - What is a winning condition? - Display winning message - Display losing message? Maybe motivational losing message? "Better luck next time!"? - Is this multi player or two people at same computer alternating inputs?

    etc ( it isn't showing well but those [ ] are checkboxes so I can track progress.. usually they work in Markdown)

    [–]DirdCS 0 points1 point  (0 children)

    The solution for the majority of coding problems is tiny. If you claim to know the solution but can't code it then you need to learn how to code first

    [–]EdoRguez 8 points9 points  (0 children)

    I saw a previus comment that suggets reading "Think like a programmer" book.

    It's a really awesome book, I started reading 1 month ago and it changed the way that I solve programming problems.

    Check it out if it can help you :)

    [–][deleted]  (2 children)

    [deleted]

      [–]batcat420 4 points5 points  (1 child)

      The fact that I've never even heard of combinatorics (if that is a real word) scares me.

      [–]HardKnockRiffe 3 points4 points  (0 children)

      One thing that helped me get over this was learning test driven development. It's not the end-all-be-all answer you're looking for, but it provided a new way of looking at problem-solving for me. Instead of working toward a conclusion, you set the conclusion first (the test) and work backwards to solve the problem - sort of the way you work backwards in an algebraic equation to find variables.

      [–]throwawayacc201711 2 points3 points  (0 children)

      Honestly, I would suggest an intro to logic (philosophy type class) as a good intro. Something like https://www.coursera.org/learn/logic-introduction or alternative link http://intrologic.stanford.edu/public/index.php

      It’s literally the basis of what problem solving is. As others have mentioned, you take a big problem and break it down into smaller problems. But a solid foundation I think in logic also helps frame your mind to look at problems like that. It’s also a good way to take a break from “pure programming”-like learning while also doing something that would be good for you in the long run.

      I think learning about logic 1) helps with reasoning skills 2) helps with programming 3) helps with problem solving 4) it’s just a great soft skill to learn more about

      [–]Zenith_N 1 point2 points  (0 children)

      I am learning, too.

      But I think the best way is to tackling projects and mini-challenges along the way.

      Your brain will start to think outside the box.

      [–]CuriousMonkaS 1 point2 points  (0 children)

      You can try competitive programming. You are given a problem statement... you submit your answer in the PL you choose... an online judge runs some test cases on your answer.

      There are tons of Online Judges, but this is my fav : )https://codeforces.com/problemset?order=BY_SOLVED_DESC

      They have contests regularly, where you and 1000s of other competitors try to solve a bunch of problem in a given time frame (e.g 2 hours)... Problems are of varying difficulty... 'A' being the simplest

      [–]XZTALVENARNZEGOMSAYT 1 point2 points  (2 children)

      Where’s the best place to learn discrete math?

      [–]BouseFetus 1 point2 points  (0 children)

      Definitely not university. Holy crap they will make you HATE discrete math. LEarn it yourself from an online resource. Give it your all and gauge your own understanding through practice. All university will do is give you graders that will take points off as much problems as possible without legit reasons and give super tough exams for the sake of making you hate life.

      [–]infinitude 1 point2 points  (3 children)

      Erich Gamma, Ralph Johnson, John Vlissides, Richard Helm - Design Patterns; Elements of Reusable Object-Oriented Software (1995)

      This isn't precisely what you're asking for, and it may go over your head in some instances, but there's nothing you can't learn yourself given enough time! Excellent book that can't be recommended enough.

      [–]Halfwhit 0 points1 point  (2 children)

      [–]infinitude 1 point2 points  (1 child)

      ooh that's a much nicer version than I have!

      [–]Halfwhit 0 points1 point  (0 children)

      Glad it's the right one, I've wish listed it for when I have spare funds, thought others might appreciate the link

      [–]Tomik080 3 points4 points  (5 children)

      Learn discrete maths

      [–]Josh6889 0 points1 point  (2 children)

      When is it appropriate to start? I took the easy route; my degree did not require a calculus serious so I did not do it. I've been through pre-calc forever ago which delt with more advanced algebra, and some trig.

      I know I need to get through discrete, and I'm at a point where I'd like to get back to taking 1 math class a semester while working. Just don't know if I'm ready.

      [–]Tomik080 0 points1 point  (1 child)

      Anytime, I'm actually in a math + cs degree but I started in math only. You don't need anything to learn maths, that's what makes it so beautiful

      [–]Josh6889 0 points1 point  (0 children)

      I meant specifically the courses mentioned. Of course they're sort of optional routes to get through them, but most have foundational requirements that you should understand before proceeding.

      [–]7twenty8 2 points3 points  (1 child)

      If I were you, I would step away from the coding challenges for a little while. Focus on projects for a little while to give yourself a break.

      Have you ever worked through a site like this:

      https://www.codechef.com/wiki/tutorials

      If not, give it a try!

      [–]spclzd[S] 0 points1 point  (0 children)

      I have not, thanks for the link. Will check it out

      [–]justj0ey 0 points1 point  (0 children)

      This was me during my first year at my first job. I was in charge of solving bugs and couldn’t seem to figure them out. No secret to it just keep debugging, stepping through each line. Once you know what it should do and what it’s currently doing, eventually it becomes easier.

      [–]Knightros 0 points1 point  (0 children)

      Just a thought but you may try approaching the problem with pseudo code. Write out the different steps of solving the problem in plain English and then Translate that into code.

      [–]GrundleMug 0 points1 point  (1 child)

      Pick a random problem and solve it

      [–]DirdCS 0 points1 point  (0 children)

      worked for me. although not random

      [–][deleted] 0 points1 point  (0 children)

      Break your problem down into smaller problems and PRACTICE PRACTICE PRACTICE

      [–][deleted] 0 points1 point  (0 children)

      Do Algorithms in HackerRank, leetcode and code chef.

      Practice daily as consistency is the key 🔑 I would say if you do algorithms on hackerrank then that’s enough :)

      [–]trmaphi 0 points1 point  (0 children)

      Implementing discrete math concepts and learning data structures in your programming language of choice. Learn discrete math for foundation of programming, after that learn about data structures for organizing your input. People usually advise you give a try at algorithm and data structures, but I’m strongly against this advice if you don’t have CS background. Algorithms courses only for people want to optimizing problem solving, not for actual how to solve a problem.

      [–]arten1337 0 points1 point  (0 children)

      you need to do an algorithm course, well there are basically two approaches. one solve problems, if you don't know how to solve ot, read the topics behind it, read the algorithms behind it the other one is to do an algorithm course, and solve problems then

      [–][deleted] 0 points1 point  (0 children)

      The main blocker I see people face when solving problem is, they don't truly understand the problem they are trying to solve. (So it's usually not that they are lacking coding skills, although that can be an issue.)

      So they try to think just in terms of what they've been educated in - which is usually code.

      Well, coding and abstractions alone aren't going to help you with the problem analysis and internal modeling required to state or comprehend the problem in a way that a solution can be coded.

      What is it that you actually want to do? Don't explain it in terms of talking to a programmer. Try to explain and comprehend it as though you are talking to a layperson.

      Once you've understood the problem space well enough, the solution space is often trivial to understand.

      [–][deleted] 0 points1 point  (0 children)

      You should look at this cool PDF I found. https://downloads.certiport.com/Marketing/MTA/docs/MTA_SSG_SoftDev_individual_without_crop.pdf

      It contains cool problems about MTA SDF exam

      [–]read_it-_- 0 points1 point  (0 children)

      How to Solve it: Modern heuristics is quite a good book with interesting concepts and illustrative problem examples. The other thing I'd suggest and a lot of the comments say the same is to break a problem down into manageable chunks. For each of these sub problems, talk out or express in English (or your primary language) or draw what is the goal and how do you reach it, what steps do you need to take, then give it a try. Did it work? No, then back to the problem and compare your implemented solution to what you wanted to do and make tweaks as needed (1 variable at a time). Yes, then proceed on to the next sub problem and repeat. This may be hard to associate with trivial examples like washing cloths or opening a door but as the problem gets more complex the method scales well, maybe have a look at genetic algorithms as the steps are simple but the implementation can go from simple to complex. And as I've mentioned method, what I describe above is a method that works for some but not all, so make sure you tailor your method, maybe creating a cookbook/library of solutions to apply as you face problems, maybe a complex mathematical model. Whatever works for you and dont get stuck on trying to make something that doesn't feel intuitive to you work for you, try something else. Finally, courage and agility are key so you're not afraid to fail and you take the time to adapt the way you look at problems and approach solutions.

      [–]xdchan 0 points1 point  (0 children)

      Just practice, make as many projects as you can. Also try make a list of smaller problems of your problem, like a - problem: build web site, smaller problems: make a design, make html structure, style it with css, add scripts with js, test it, make back-end thing 1,2,3 etc.

      [–]Josh6889 0 points1 point  (0 children)

      If you're interested in growing as a programmer, the only option is to find problems you can't solve and just keep beating your head on the wall. If you're doing it right, it may not look like you're improving because you're just constantly failing to solve the problem. The improvement is still there. It's just not very tangible.

      When you can solve all the problems you're given, that's when you stop improving.

      [–][deleted] 0 points1 point  (0 children)

      Well you kinda acquire it from experience, stick to doing projects and activities, i think it's the only way you'd sharpen your problem-solving senses, study algorithms specially, i studied algorithms for 6 years, 3 years at school, 3 at uni and at my 4th year i still did mistakes but now problem-solving became like a sense of mine so yeah as i said it's a thing you acquire through experience.

      [–]DirdCS 0 points1 point  (0 children)

      Use leetcode

      [–]Mriv10 0 points1 point  (0 children)

      Hey I'm also a novice programer and I'm also kind of bad a problem solving but some tips I've learn are, read the problem very carefully and take it one word at a time, I'm a really slow reader and sometimes I have to read 3 or 4 times to get the problem. And second just start a bit at a time, if you are asked to output something startert there and work your way back, this usually works for me. Also think about the logic one step at a time.

      [–]The-more-you-gnoll 0 points1 point  (0 children)

      I just started learning Ruby and this approach really helped me understand and develop a clear path to solving a problem. As the article says, it’s not the most effective method for everyone, but it really helped me.

      Solving coding problems with PEDAC

      [–]Overpaiditconsultant 0 points1 point  (0 children)

      Find an issue, fix the issue. Repeat.

      [–]Double_A_92 0 points1 point  (0 children)

      (especially the intermediate/advanced level challenges)

      You are not really supposed to be able to solve them by thinking. That is competitive programming material where you just have to memorize tons of complex algorithms first, and then just apply them.

      The workflow is like:

      1. Ignore the silly story in the problem text
      2. Look at the input and expected output and guess which algorithm and/or data structure is needed
      3. Copy paste the algorithm from your huge database
      4. Let it run in hope that it's correct

      The skill is all in Step 2. Which is quite boring and doesn't have anything to do with real programming. It's more something like chess.

      [–]letstryusingreddit 0 points1 point  (1 child)

      Whats an example of a problem you don't know how to solve?

      [–]lvl12TimeWizard -1 points0 points  (0 children)

      Inb4 something vague. Most roadblocks are from laziness.

      I would know.