Hackerrank Exercises

Muhamad Abduh
3 min readJan 9, 2023

--

At the end of 2022, I got challenge from my tech lead to solve some problems in Hackerrank. The goals was to gain enough points to reach 3rd star level with minimum 200 points of problem solving topic. My last submission in topic problem solving hackerrank was three years ago and my current point was 31. So the challenge was very good to push me a little bit before I begin 2023 journey as backend engineer.

I picked some easy-level problems with 10 or 15 points for loosen up and get familiarized with the problems from Hackerrank. Until I was ready for the final problems with expert-level : string similarity. These were the problems that I picked to solve:

  • Diagonal Difference (easy, 10 points)
  • Plus Minus (easy, 10 points)
  • Stair-case (easy, 10 points)
  • Mini-max Sum (easy, 10 points)
  • Time Conversion (easy, 15 points)
  • Day of Programmer (easy, 15 points)
  • Cut the Sticks (easy, 25 points)
  • String Simmilarity (expert, 100 points)

Some Tips

In Hackerrank, the problem page was divided into two sections: problems and solution. In the solution section you can choose any language of programming you prefer. For me, Javascript (Nodejs) or Typescript is my favourite. There are also some panels in the sidebar : Discussions, Leaderboard, and submissions.

At the answer section, you can only write your code in the certain line (at the commented line write your code here).

Use Text Editor

I prefer to write my code in my text editor first. If my code works , then I copy and pasted it in the answer section. You can use your own text editor offline or I suggest you use online text editor like replit so you don’t need to change window from your browser.

Write your code right away

Talk is cheap, show me the code. (Linus Torvalds)

Some programmer spend too much time thinking about how to solve the problem. If you found some difficulties , just write your code immediately after you read the description of the problem. In that way, the solution will slowly reveals themself and finally you can refactor your code in order to make it simpler and more efficient.

Question

When I tried to solve the Cut the sticks problem, I used the recursive approach. In my code, I put one additional parameter to the given function in the answer section. It just leave me questioning, can I just add some code but not below the comment “Write your code here” line. I tried to search in Google to check but still don’t get the answer.

If you know the terms and condition regarding about my question above please leave comment.

--

--