본문 바로가기

javascript78

[JS] 383. Ransom Note 해시맵을 사용한 문제 처음에는 두 해시맵을 JSON.stringify 로 문자열로 만들어 같은지를 비교하려 하였으나, 객체의 순서가 다를 수 있으므로 그냥 적은 쪽의 문자를 객체에서 하나씩 빼어 해결하였다 체감 난이도 백준 5 https://leetcode.com/problems/ransom-note/ Ransom Note - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com var canConstruct = function (ransomNote, magazine).. 2022. 11. 18.
[JS] 1342. Number of Steps to Reduce a Number to Zero 리트코드 easy 난이도는 쉬운 문제가 많다 백준 브론즈 1에서 실버 5 정도도 꽤 있는듯하다 https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero/ Number of Steps to Reduce a Number to Zero - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /** * @param {number} num * @return {number} */ var numberOfSt.. 2022. 11. 18.
[JS] 412. Fizz Buzz 조건문 기본 문제 if 문을 어떻게 사용하냐에 따라 속도나 비용의 효율을 높일 수 있겠다 https://leetcode.com/problems/fizz-buzz/ Fizz Buzz - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /** * @param {number} n * @return {string[]} */ var fizzBuzz = function(n) { const ans = []; for (let i = 1; i 2022. 11. 16.
[JS] 1672. Richest Customer Wealth 이차원 배열의 연산 문제 map 과 reduce 를 사용해서 풀어보았다 https://leetcode.com/problems/richest-customer-wealth/ Richest Customer Wealth - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /** * @param {number[][]} accounts * @return {number} */ var maximumWealth = function (accounts) { const wealths .. 2022. 11. 16.