Character Points

An RPG game lets you assign points to various attributes of your character to improve it. The points earned by the character are available to assign across all attributes. Each attribute can only be assigned at most 70% of totalPoints (rounded down to the nearest integer) unless totalPoints is 1, in which case only one attribute can get a maximum of 1 point. The sum of all points assigned plus the points remaining should add up to totalPoints.

Implement the CharacterAttributes component with the logic described above and the following requirements:

  • Points should be assigned by moving the slider and the remaining points should be displayed in the span tag.
  • When initialized, all points are available and all sliders start at 0.
  • Each slider must have a range from 0 up to totalPoints.

For example, if totalPoints is 15 then the user shouldn't be able to drag the slider past 10 even if more points are available.

HTML5, CSS3, React v18
Loading...
Loading...

Tags

  • AI-resistant
  • React
  • Data Binding
  • React Hooks
  • State Hook
  • New
  • Public
  • Easy

Information

Difficulty: Easy

Duration: 20 min

Score Distribution

% of candidates
0-33%
34-67%
68-100%
Score

Would you like to see our other questions?

We have 1000+ premium hand-crafted questions for 160+ job skills and 20+ coding languages. We prefer questions with small samples of actual work over academic problems or brain teasers.

Would you like to see our tests?

The following tests contain React related questions:

On the blog

Since we're all biased and we use incorrect proxies, why not just outsource hiring to experts or recruitment agencies? After all, they've been screening people for many years, so they must know how to do it right?

Not really. I was surprised to discover that many experts...