Instantly share code, notes, and snippets.

# Mantoh Nasah Kuma Nasah-Kuma

Created March 16, 2023 11:32
Solution to HackerRank's Mini-max-sum challenge: https://www.hackerrank.com/challenges/mini-max-sum/problem?isFullScreen=true
View mini-max-sum.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* * Complete the 'miniMaxSum' function below. * * The function accepts INTEGER_ARRAY arr as parameter. */ function miniMaxSum(arr) { // Write your code here arr.sort();
Created March 8, 2023 06:02
Solution to HackerRank's Sock Merchant Challenge: https://www.hackerrank.com/challenges/sock-merchant/problem?isFullScreen=true
View sockMerchant.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* * Complete the 'sockMerchant' function below. * * The function is expected to return an INTEGER. * The function accepts following parameters: * 1. INTEGER n * 2. INTEGER_ARRAY ar */ function sockMerchant(n, ar) {
Created February 21, 2023 10:11
Solution to HackerRank's PlusMinus challenge: https://www.hackerrank.com/challenges/plus-minus/problem?isFullScreen=true
View plusMinus.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 function plusMinus(arr) { // Write your code here let plusCount = 0; let minusCount = 0; let zeroCount = 0; const n = arr.length; for (const i of arr) { if(i < 0) minusCount++; if(i > 0) plusCount++;
Created October 7, 2022 07:14
Solution to HackerRank's Strong Password Challenge: https://www.hackerrank.com/challenges/strong-password/problem?isFullScreen=true
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* * Complete the 'minimumNumber' function below. * * The function is expected to return an INTEGER. * The function accepts following parameters: * 1. INTEGER n * 2. STRING password */ function minimumNumber(n, password) {
Created October 6, 2022 11:56
Solution to HackerRank's CamelCase: https://www.hackerrank.com/challenges/camelcase/problem?isFullScreen=true
View camelCase.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 function camelcase(s) { // Write your code here let wordCount = 1; let i = 0; while (i < s.length) { if(s[i].toUpperCase() === s[i]) wordCount++; i++; } return wordCount; }
Last active October 5, 2022 12:18
Solution to HackerRank Climbing the Leaderboards Challenge: https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem?isFullScreen=true
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* * Complete the 'climbingLeaderboard' function below. * * The function is expected to return an INTEGER_ARRAY. * The function accepts following parameters: * 1. INTEGER_ARRAY ranked * 2. INTEGER_ARRAY player */ function climbingLeaderboard(ranked, player) {
Created October 2, 2022 01:07
Solution to HackerRank Challenge: https://www.hackerrank.com/challenges/bon-appetit/problem?isFullScreen=true
View bonAppetit.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* * Complete the 'bonAppetit' function below. * * The function accepts following parameters: * 1. INTEGER_ARRAY bill * 2. INTEGER k * 3. INTEGER b */ function bonAppetit(bill, k, b) {
Created September 29, 2022 06:45
HackerRank Challenge BirthCandles: https://www.hackerrank.com/challenges/birthday-cake-candles/problem?isFullScreen=true
View birthdayCandle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 function birthdayCakeCandles(candles) { const max = Math.max(...candles); let counter = 0; for(let candle of candles) { if (candle === max) counter++; } return counter; }
Last active September 28, 2022 06:24
Hackerrank Challenge: https://www.hackerrank.com/challenges/staircase/problem?isFullScreen=true
View staircase.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* * Complete the 'staircase' function below. * * The function accepts INTEGER n as parameter. */ function staircase(n) { // Write your code here let newString = ''; let j = n-1;
Created September 23, 2022 15:09
Hackerrank Challenge: https://www.hackerrank.com/challenges/migratory-birds/problem?isFullScreen=true
View migratoryBirds.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 function migratoryBirds(arr) { // Write your code here let countA = 0; let countB = 0; let countC = 0; let countD = 0; let countE = 0; for (let item of arr) { switch (item) { case 1: countA++;