I recently graduated with a computer science degree in a top 50 school and have been grinding leetcode in preparation of applying to a job. I have no work experience and had a lot of help to get through the degree. About half of the coding assignments required for my degree I either didn’t do or was carried. I also got generous accommodations due to a disability. My in major GPA is 3.0.
I take an extremely long time to come up with solutions to any problems. I enjoy trying to solve problems and coming up with a high level solution, but I get stuck for hours on details or miss vital parts of the algorithm so often it becomes a drag. Personal projects take me an extreme amount of time too and I haven’t made any of note. I’m not good at organizing code and I am not detail orientated which means I tend to get a lot of one off type errors and can take hours to find them. Even problems I’ve seen before, I’ll likely forget the solution or fail to recreate it.
To give a concrete example of some of the above, just this morning I tried to code the brute force solution following problem: Give two sorted arrays return the median. I spent over an hour trying to implement the brute force solution involving linearly going through each array and couldn’t code it in Python. The entire time I was struggling to figure out how to increase the respective index variables given different cases, how I would ensure one of the numbers the indices landed was the median, how to differentiate which of the array indices I was keeping track of was the actual median and finally how to determine the next number I needed if the lengths of both arrays were even.
Many problems go the same way. I don’t know what the difference between the normal struggle associated with coding is and the sort of struggle that means it’s just not for me. I'm not looking for encouragement per se, but objective feedback on which group I belong to and practical advice on how to move forward.
Programming is akin to building a house. Once the blueprint is figured out, the actual act of building (putting bricks together, etc) is actually pretty straightforward. The key though, is good the planning.
By good planning, in your example of returning the median, you should solve the problem before touching your computer. Use either pencil-and-paper or whiteboard method as much as possible. For example, I'd plan it as follow: 1. Solve it in a high-level manner, as if you're trying to teach someone who never codes a program before 2. Write down all the function definitions you need (don't code the body, just know what each does) 3. Write down how all the functions are to interact (again, don't write the body of any of the functions yet, just assume you have them) 4. Write down pseudocode for each of the functions 5. Code
I've seen lots of beginner programmers tried to skip over to 5 without concrete plan only ended up confusing himself over trivial problem. No matter how tempting it is, jumping straight to 5 without concrete plan is only going to confuse you.
I forgot whether it was Leslie Lamport or Edsger Dijkstra, but one of them said that a good programmer should have the skill to fully plan out a computer program without coding it.