Monday, February 5, 2024

First test in new year

 I've just taken a test provided by Hackerrank, to apply for a FE senior position in Positive Thinking Company.

The test contained 5 single-choice questions and 2 coding challenges.

I quickly moved over the first 5 questions, then stucked on the 6th one which is an algorithm coding exercise. 

The question asked to get the maximum value of ratings array if we cannot skip 2 concecutive numbers (can skip one then must take the next one). In this case we need to have 

Example:

input:

[-1, -2, -3, -4, -5]

output:

-6

explanation:

take [-2, -4] and skip others to have maximal number of -6

The last question was about moving data among parttitions in a hard disk to store data in the least partitions possible.

Example:

input:

- used: [3, 2, 1, 3, 1]

- total capacity: [3, 5, 3, 5, 5]

output:

2

explanation:

move first partition to second partition, move third and last partitions to 4th partition, then we have result of [0, 5, 0, 5, 0] which stores in 2 partitions.

I had feedback right away: FAILED :(

40% (need 50% to be mid and 60% to be senior)


I need to practice more algorithm then.

No comments: