This file contains hidden or 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 caesarCipher(phraze: string, offBy: number): string { | |
function hasLowerCase(str: string): boolean { | |
return /[a-z]/.test(str); | |
} | |
function hasUpperCase(str: string): boolean { | |
return /[A-Z]/.test(str); | |
} | |
// Here's that alphabet string | |
const aToZ = "abcdefghijklmnopqrstuvwxyz"; | |
const uppercaseAtoZ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
This file contains hidden or 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 pangrams(s) { | |
// String to hold EN alphabet | |
const alphabet = "abcdefghijklmnopqrstuvwxyz"; | |
// Regex to remove all white spaces | |
const removeSpaces = /\s/g; | |
// take String s and change to lowercase | |
s = s.toLowerCase().replace(removeSpaces, ""); | |
// Loop over the alphabet and check for each letter | |
for (let index = 0; index < alphabet.length; index++) { |
This file contains hidden or 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 countingSort(arr) { | |
// Create new Array to hold sorted values | |
const results = new Array(10).fill(0); | |
// Loop through array and add values to results array | |
for (let i = 0; i < arr.length; i++) { | |
const currentNum = parseInt(arr[i], 10); | |
if (typeof results[i] === undefined) { | |
results[i] = 0; | |
} |
This file contains hidden or 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 'diagonalDifference' function below. | |
* | |
* The function is expected to return an INTEGER. | |
* The function accepts 2D_INTEGER_ARRAY arr as parameter. | |
* | |
*/ | |
function diagonalDifference(arr) { | |
// Loop over the array both ways |
This file contains hidden or 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 'lonelyinteger' function below. | |
* | |
* The function is expected to return an INTEGER. | |
* The function accepts INTEGER_ARRAY a as parameter. | |
*/ | |
function lonelyinteger(a) { | |
// If a is only 1 int long just return it | |
if(a.length == 1) { |
This file contains hidden or 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 timeConversion(s) { | |
// Take the time passed in and check for AM | PM | |
// If the time is AM, then just remove the AM unless it's 12 | |
if (s.endsWith("AM")) { | |
// add the first 2 numbers from s to firstNumSet | |
let firstNumSet = parseInt(s.substring(0,2)); | |
// if first number is 12, make it 00 | |
if (firstNumSet === 12) { | |
firstNumSet = "00"; |
This file contains hidden or 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
.fun-animation { | |
animation: 3s linear 1s infinite running slidein; | |
} | |
/* Here's where we turn the animation off */ | |
@media (prefers-reduced-motion) { | |
.fun-animation { | |
animation-name: none; | |
} | |
} |
This file contains hidden or 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
describe(`My First Test`, function () { | |
it(`Is doing something...?`, function () { | |
expect(true).to.equal(true) | |
}) | |
}) |