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
@mixin spacing { | |
--spacing-none: 0; | |
--spacing-extra-small: 4px; | |
--spacing-small: 8px; | |
--spacing-medium: 12px; | |
--spacing-large: 16px; | |
--spacing-extra-large: 20px; | |
--spacing-extra-extra-large: 32px; | |
--spacing-extra-extra-extra-large: 40px; | |
} |
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
@mixin spacing { | |
--spacing-none: 0; | |
--spacing-extra-small: 4px; | |
--spacing-small: 8px; | |
--spacing-medium: 12px; | |
--spacing-large: 16px; | |
--spacing-extra-large: 20px; | |
--spacing-extra-extra-large: 32px; | |
--spacing-extra-extra-extra-large: 40px; | |
} |
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
/** | |
* Given an array of integers, return indices of the two numbers such that they add up to a specific target. | |
* You may assume that each input would have exactly one solution, and you may not use the same element twice. | |
* | |
* @param {Array<number>} nums | |
* @param {number} target | |
* @return {Array<number>} | |
*/ | |
const nums: Array<number> = [3, 5, 8, 15, 22, 78] | |
const target: number = 30 |
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 array = [0, 1, 3, 4, 31, 2, 4, 6, 7, 10, 23, 30]; | |
/** | |
* Merge Sort is a divide and conquer algorithm. It divides input array in two halves, | |
* calls itself for the two halves and then merges the two sorted halves. | |
* time complexity: O(nLogn) | |
* space complexity: O(n) | |
* @param arr | Array<number> | |
* @return Array<number> | |
*/ |
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
// Reverse a string with the Array.reverse() method, recursive method, the for loop method, or the ES6+ method. | |
const revString = 'olraC si eman ym iH' | |
/** | |
* Reversing a string with a for loop | |
* @param str | string | |
* @returns | string | |
*/ | |
function forLoopStringReversal(str) { | |
let newStr = ''; |
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
// Given an array of numbers as an argument, and a number as a second argument | |
// find two numbers in the array that adds up the sum. | |
// const array = [2, 8, -19, 33, 923]; | |
// const sum = 904; | |
// returns [-19, 923] | |
/** | |
* Function that searches for a pair of numbers which add up to the given sum | |
* @param array | Array<number> | |
* @param sum | number |
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
// Do two given strings form an anagram? | |
// Possible solution should not be a higher Big O notation than O(n). | |
// Evaluation is case insensitive. | |
/** | |
* @param str1 | String | |
* @param str2 | String | |
* @return Boolean | |
*/ | |
const isItAnAnagram = (str1, str2) => { |