diff --git a/JinHaLim/Easy/solution_1688.js b/JinHaLim/Easy/solution_1688.js new file mode 100644 index 0000000..f94f6d9 --- /dev/null +++ b/JinHaLim/Easy/solution_1688.js @@ -0,0 +1,19 @@ +/** + * @param {number} n + * @return {number} + */ +var numberOfMatches = function(n) { + let sum = 0; + while (n > 1) { + if (n%2 === 0) { + n = n/2; + sum += n; + }else{ + n = (n-1)/2 ; + sum += n; + n += 1; + } + } + return sum; +}; +console.log(numberOfMatches(5)) \ No newline at end of file diff --git a/JinHaLim/Easy/solution_1832.js b/JinHaLim/Easy/solution_1832.js new file mode 100644 index 0000000..646ce3f --- /dev/null +++ b/JinHaLim/Easy/solution_1832.js @@ -0,0 +1,16 @@ +/** + * @param {string} sentence + * @return {boolean} + */ +var checkIfPangram = function(sentence) { + const alphabet = 'abcdefghijklmnopqrstuvwxyz'; + for (let i = 0; i < alphabet.length; i++) { + if (!sentence.includes(alphabet[i])) { + return false; + } + + } + return true; +}; +console.log(checkIfPangram("thequickbrownfoxjumpsoverthelazydog")) +console.log(checkIfPangram("leetcode")) \ No newline at end of file diff --git a/JinHaLim/Easy/solution_1859.js b/JinHaLim/Easy/solution_1859.js new file mode 100644 index 0000000..a5a3507 --- /dev/null +++ b/JinHaLim/Easy/solution_1859.js @@ -0,0 +1,12 @@ +/** + * @param {string} s + * @return {string} + */ +var sortSentence = function(s) { + let arr = s.split(' '); + return arr.reduce((acc,curr) => { + acc[curr[curr.length-1]-1] = curr.slice(0,curr.length-1); + return acc; + },new Array(arr.length)).join(' '); +}; +console.log(sortSentence("is2 sentence4 This1 a3")); \ No newline at end of file