Efficient HackerRank solutions in JavaScript programmed by Gabriel Giordano
Problem
Solution
Difficulty
Points
Note
⭐
Matrix Layer Rotation
JavaScript
Hard
80
Math solution to the problem, O(1) if the loop to print the result isn't considered, otherwise O(m*n)
⭐
ACM ICPC Team
JavaScript
Easy
25
Using bitwise operations, and a custom Hamming Weight implementation to count ones, because the HackerRank's v8 version hasn't yet a BigInt implementation. Best case O(n^2) where n is the topics length
⭐
Queen's Attack II
JavaScript
Medium
30
Math solution to the problem, O(k) , where k is the number of obstacles
⭐
Modified Kaprekar Numbers
JavaScript
Easy
30
Math and very performatic solution, without using Strings nor brute force, O(n) , where n = q - p
Equalize the Array
JavaScript
Easy
20
O(n)
⭐
Jumping on the Clouds
JavaScript
Easy
20
O(log n)
⭐
Repeated String
JavaScript
Easy
20
The algorithm doesn't count the string a second time, both best and worst case is O(n) where n is the length of the string
Lisa's Workbook
JavaScript
Easy
25
Bigger is Greater
JavaScript
Medium
35
Organizing Containers of Balls
JavaScript
Medium
30
The Time in Words
JavaScript
Medium
25
O(1)
Beautiful Triplets
JavaScript
Easy
20
O(n)
Minimum Distances
JavaScript
Easy
20
O(n)
Halloween Sale
JavaScript
Easy
20
O(1)
Non-Divisible Subset
JavaScript
Medium
20
Cut the Sticks
JavaScript
Easy
25
Library Fine
JavaScript
Easy
15
O(1)
Sherlock and Squares
JavaScript
Easy
20
O(1)
Append and Delete
JavaScript
Easy
20
O(min(s, t))
Extra Long Factorials
JavaScript
Medium
20
Service Lane
JavaScript
Easy
20
Chocolate Feast
JavaScript
Easy
25
O(1)
Find Digits
JavaScript
Easy
25
O(n)
Jumping on the Clouds: Revisited
JavaScript
Easy
15
O(n / k) where k is the number of jumps
Sequence Equation
JavaScript
Easy
20
Circular Array Rotation
JavaScript
Easy
20
Save the Prisoner!
JavaScript
Easy
15
O(1)
⭐
Viral Advertising
JavaScript
Easy
15
Alternative way to solve it using this integer sequence formula: https://oeis.org/A061418
Beautiful Days at the Movies
JavaScript
Easy
15
O(n)
Angry Professor
JavaScript
Easy
20
O(n)
Utopian Tree
JavaScript
Easy
20
O(1)
Designer PDF Viewer
JavaScript
Easy
20
The Hurdle Race
JavaScript
Easy
15
O(1)
Climbing the Leaderboard
JavaScript
Medium
20
O(n + log(m))
Picking Numbers
JavaScript
Easy
20
O(1)
⭐
Forming a Magic Square
JavaScript
Medium
20
Using Édouard Lucas general formula to generate all possible magic squares of order 3
Cats and a Mouse
JavaScript
Easy
15
O(1)
Eletronics Shop
JavaScript
Easy
15
Counting Valleys
JavaScript
Easy
15
O(n)
Drawing Book
JavaScript
Easy
10
O(1)
Sock Merchant
JavaScript
Easy
10
O(1)
Bon Appétit
JavaScript
Easy
10
O(n)
Day of the Programmer
JavaScript
Easy
10
O(1)
Migratory Birds
JavaScript
Easy
10
Divisible Sum Pairs
JavaScript
Easy
10
Birthday Chocolate
JavaScript
Easy
10
Breaking the Records
JavaScript
Easy
10
O(n)
Between Two Sets
JavaScript
Easy
10
Using Euclid's division algorithm for greatest common divisor
Kangaroo
JavaScript
Easy
10
Apple and Orange
JavaScript
Easy
10
Grading Students
JavaScript
Easy
10
Interview Preparation Kit