Instantly share code, notes, and snippets.

# Mantoh Nasah Kuma Nasah-Kuma

Last active September 8, 2022 09:47
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 'gradingStudents' function below. * * The function is expected to return an INTEGER_ARRAY. * The function accepts INTEGER_ARRAY grades as parameter. * https://www.hackerrank.com/challenges/grading/problem?isFullScreen=true */ function gradingStudents(grades) {
Created September 12, 2022 08:12
View ExtraLongFactorial.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 add(str1, str2) { let sum = ""; let str1Length = str1.length; let str2Length = str2.length; // if s2 is longer than s1, swap them. if(str2Length > str1Length ){ let temp = str2; str2 = str1;
Created September 14, 2022 21:15
Divisible Sum Pairs Hackerrank Challenge: https://www.hackerrank.com/challenges/divisible-sum-pairs/problem?isFullScreen=true
View divisibleSumPairs.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 divisibleSumPairs(n, k, ar) { // Write your code here let counter = 0; for(let i = 0; i < n; i++) { for (let j = i+1; j < n; j++) { if ((ar[i]+ar[j]) % k === 0) counter++; } } return counter;
Last active September 16, 2022 13:11
Kangaroo Hackerrank Challenge: https://www.hackerrank.com/challenges/kangaroo/problem?isFullScreen=true
View kangaroo.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 'kangaroo' function below. * * The function is expected to return a STRING. * The function accepts following parameters: * 1. INTEGER x1 * 2. INTEGER v1 * 3. INTEGER x2 * 4. INTEGER v2 */
Created September 19, 2022 12:44
Hackerrank breaking-worst-best-record challenge: https://www.hackerrank.com/challenges/breaking-best-and-worst-records/problem?isFullScreen=true
View breakingRecords.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 breakingRecords(scores) { // Write your code here let [min, max] = [0, 0]; let minScore = scores[0]; let maxScore = scores[0]; for(let i = 1; i < scores.length; i++) { if (scores[i] < minScore) { min++; minScore = scores[i]; } else if(scores[i] > maxScore) {
Created September 21, 2022 09:45
Hackerrank Challenge day-of-the-programmer : https://www.hackerrank.com/challenges/day-of-the-programmer/problem?isFullScreen=true
View dayOfProgrammer.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 dayOfProgrammer(year) { // Write your code here let feb = 0; let initialDaySum = 0; if (year >= 1700 && year <= 1917) { if (year % 4 === 0) feb = 29; else feb = 28; } else if (year > 1918 && year <= 2700) {
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++;
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 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; }
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) {