Instead of just trying to write code to solve these algorithm challenges, you need to try to write out the algorithm (on paper or typed out in a word processor) first. This means writing out the step-by-step process you think your solution would need to follow to correctly solve the problem. Before writing any code, you look at the test cases and what values they should return and walk through your steps to validate your algorithm would do that.
If you get stuck, instead of looking at the solutions immediately, click the Ask a Question button which will populate a new forum topic with any code you have written and either tell us what you are having trouble understanding (if the instructions are not clear to you) or show us your current written algorithm and let us confirm you are on the right track, or if you have the right algorithm and are struggling with a certain section of code syntax or logic, tell us what you are expecting a certain part of your solution to do which it is not. We will then attempt to guide you to a solution you can call your own.
As a last resort or after you have solved the challenge, take a look a the solution(s) to see other ways of solving the problem.
Working through algorithm problems is probably the hardest thing to master. It takes lots of practice working on other algorithm problems. Over time with enough practice, you will start to recognize patterns in problems and be able to quickly recognize a general approach. The key here is that it takes lots of practice. Some users already have some programming background with another languages, so they make work through them faster than others. Most people do struggle through the first half of the Basic Algorithm section and then get more comfortable as they progress through more of them.