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
const bingeWatching = (timeElapsed, duration, action, amount) => { | |
const timeStrToSeconds = (str) => { | |
newArr = str.split(':').map(Number) | |
return (newArr[0] * 3600) + (newArr[1] * 60) + newArr[2] | |
} | |
const secondsToTimeStr = (seconds) => { | |
let hours = Math.floor(seconds / 3600) | |
if (hours === 0) { | |
hours = "00" |
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
//First Problem Solution | |
const consecutiveOddOrEvenDigits = (num) => { | |
let newArr = [] | |
const digits = num.toString().split('') | |
const numArr = digits.map(Number) | |
console.log(numArr) | |
while (numArr.length > 0) { | |
let j = 1 | |
while (numArr[0] % 2 === numArr[j] % 2) { |