Member-only story
HackerRank Frontend Interview questions with expert answers

Hello everyone, today we will cover some interview questions in Frontend Developer interview rounds at HackerRank.
Founded in 2012, HackerRank is a technology company that focuses on competitive programming challenges for both consumers and businesses. On February 13, 2018, they had raised $30 million in Series C funding, led by JMI Equity.
If that’s got you excited then let’s start off with the actual questions
Q1. Design a 5-star rating system with half-star, hover, and click functionality
Creating a star rating system is a little challenging in itself. Creating one with a half-star rating system is even more challenging. We must break down the problem into smaller steps to solve it properly. So first let’s discuss the approach.
Approach
To simplify the problem, we are going to assign a half star if the star is clicked from the left-hand side and a full star if the star is clicked from the right side. Next, we need to handle the following cases:
- Render the stars dynamically: We first need to use an array to generate the required number of stars.
- Differentiate between full and half stars: Then we can detect…