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
Name Character Entity | |
Copyright ยฉ © | |
Registered ยฎ ® | |
Trademark โข ™ | |
Curly Open Double Quote โ “ | |
Curly Closed Double Quote โ ” | |
Curly Open Single Quote โ ‘ | |
Curly Closed Single Quote โ ’ | |
Big Bullet/Dot โข • |
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
/*----------------------------------------------------------------------------- | |
1.check the multiple | |
2.the fifteen's case must be first. | |
the reference is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch | |
-----------------------------------------------------------------------------*/ | |
// 15X ->> 'FizzBuzz' | |
// 5X ->> 'buzz' | |
// 3X ->> 'fizz' | |
function fizbuz(n) { |
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
/*----------------------------------------------------------------------------- | |
1.check if the 1st argument's words is existing at the 2nd argument. | |
2.the function is used to check if the latter is more apples than the former. | |
the reference is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch | |
-----------------------------------------------------------------------------*/ | |
/*๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ๏ผ | |
NOTES๏ผTime complexity, Big O notation๏ผ๏ผ |
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
/*----------------------------------------------------------------------------- | |
1.check if the string that reversed is as same as the origin. | |
2.ignoring the situation like upper or lower, and punctuation. | |
the reference used at the second function is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch | |
-----------------------------------------------------------------------------*/ | |
function isPalindrome(string) { | |
var reg = /[a-z]/g; | |
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
/*----------------------------------------------------------------------------- | |
1.turn every word into another word by the same process. | |
2.just like a puzzle | |
3.the map() method need to assigned to a variable. | |
the reference is by me, oh yah. | |
-----------------------------------------------------------------------------*/ | |
function caesarCipher(str, num) { | |
arr = str.split(""); |
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
/*----------------------------------------------------------------------------- | |
1.reverse every word in the sentence. | |
2.the orders between words do not change. | |
the reference used at the second function is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch | |
-----------------------------------------------------------------------------*/ | |
function reverseWords(str) { | |
return str.split('').reverse().join(''); | |
} |
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
/*----------------------------------------------------------------------------- | |
1.swap the elements | |
2.temporary variable is useful. | |
the reference is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch | |
-----------------------------------------------------------------------------*/ | |
function reverseArrayInPlace(arr) { | |
// dsakhpr d <-> r s <-> p a <-> h |
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
/*----------------------------------------------------------------------------- | |
1.3 function used to calculate: mean, median, mode. | |
2.writing another function to package them. | |
3.MODE: if there is no number repeated, return false. | |
3.MODE: maybe there is not only one mode. | |
the reference is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch | |
-----------------------------------------------------------------------------*/ | |
function meanMedianMode(arr) { |
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
/*----------------------------------------------------------------------------- | |
1.pair off for the required parameter 'sum'. | |
2.the former by myself is using two loops | |
3.two ways turned out to be different. | |
the reference used at the second function is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch | |
-----------------------------------------------------------------------------*/ | |
function twoSum(numArr, sum) { | |
// scrutinize every element |
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
/*----------------------------------------------------------------------------- | |
the reference is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch | |
-----------------------------------------------------------------------------*/ | |
function binarySearch(numArr, key) { | |
numArr = numArr.sort((a, b) => a - b); | |
var midIndex = Math.floor(numArr.length / 2); | |
var midElement = numArr[midIndex]; |
OlderNewer