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 denominations = ['ONE HUNDRED', 'TWENTY', 'TEN', 'FIVE', 'ONE', 'QUARTER', 'DIME', 'NICKEL', 'PENNY']; | |
const moneyDict = { | |
'PENNY': 1, | |
'NICKEL': 5, | |
'DIME': 10, | |
'QUARTER': 25, | |
'ONE': 100, | |
'FIVE': 500, | |
'TEN': 1000, | |
'TWENTY': 2000, |
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 symOfTwo = (arr1, arr2) => { | |
const set1 = new Set(arr1); | |
const set2 = new Set(arr2); | |
const combinedArr = [...set1, ...set2]; | |
const elObj = {}; | |
for (const el of combinedArr) { | |
if (el in elObj) { | |
elObj[el]++; |
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 symOfTwo = (arr1, arr2) => { | |
const output = []; | |
for (const el of arr1) { | |
if (!output.includes(el) && !arr2.includes(el)) { | |
output.push(el); | |
} | |
} | |
for (const el of arr2) { | |
if (!output.includes(el) && !arr1.includes(el)) { |
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 updateInventory(arr1, arr2) { | |
const obj1 = arr1.reduce((acc, [amt, name])=>({ | |
...acc, | |
[name]: amt | |
}), {}); | |
const obj2 = arr2.reduce((acc, [amt, name])=>({ | |
...acc, | |
[name]: amt | |
}), {}); |
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 getPermutations = arr => { | |
const output = []; | |
const swapInPlace = (arrToSwap, indexA, indexB) => { | |
const temp = arrToSwap[indexA]; | |
arrToSwap[indexA] = arrToSwap[indexB]; | |
arrToSwap[indexB] = temp; | |
}; |
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 pairwise(arr, arg) { | |
const usedDict = {}; | |
let output = 0; | |
for (let i = 0; i < arr.length - 1; i++) { | |
if (usedDict[i]) { | |
continue; | |
} | |
const iVal = arr[i]; |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" | |
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<link rel="stylesheet" href="style.css"> | |
<title>Pokedex</title> | |
</head> |
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
* { | |
box-sizing: border-box; | |
margin: 0; | |
padding: 0; | |
} | |
body { | |
display: flex; | |
font-family: sans-serif; | |
justify-content: center; |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" | |
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<link rel="stylesheet" href="style.css"> | |
<title>Connect Four!</title> | |
</head> |
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
* { | |
margin: 0; | |
padding: 0; | |
box-sizing: border-box; | |
} | |
body { | |
align-items: center; | |
background: white; | |
display: flex; |
OlderNewer