From the course: Get Ready for Your Coding Interview

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

How do I come up with an optimal solution?

How do I come up with an optimal solution?

From the course: Get Ready for Your Coding Interview

How do I come up with an optimal solution?

- [Instructor] How can I come up with an optimal solution in a coding interview? A lot of people have asked me this question, so let's talk about it. One thing to note here is that what you do before you start coding is really important in your coding interview. I would say it's at least as important as coding itself, if not more. To explain what you need to do before you start coding, let's use the problem we saw in the last chapter as an example. The problem was, given a Python list or an array of integers, find a pair of numbers that add up to 10, for example, 1 and 9, in this particular case. Let's say you're given this problem in your coding interview, but you're not sure what the optimal solution is right away. What should you do? If you're not sure how to solve it, the first thing I would do is I would come up with more examples and think with those examples in mind. So instead of thinking about this…

Contents