A lot of the problems build on top of each other. If you have already solved the easy and medium difficulty for a line of problems, the hard might come naturally. Just keep solving problems. You benefit more from the ones you solve yourself first before looking up the optimal solution.Having said that, there are problems that you will most likely not just come up with the solution. There are algorithms that were invented long ago and are taught in CS courses. Even some easy ones, say bubble sort, you would most likely not come up with them by your own. You need to do some research for those. See the comment, find what algorithm people are recommending, look it up and learn it