본문 바로가기

분류 전체보기337

[JS] 9. Palindrome Number 백준에서 본것같은 팰런드럼 확인 문제 깊은 복사 후 reverse() 로 뒤집어서 각 index 를 비교하면 된다 https://leetcode.com/problems/palindrome-number/ Palindrome Number - 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} x * @return {boolean} */ var isPalindrome = function (x) { let token = String(x.. 2022. 11. 22.
[JS] 1. Two Sum 리트코드 1번 문제! 쉽지만 천리길도 한걸음이랬다... https://leetcode.com/problems/two-sum/ Two Sum - 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[]} nums * @param {number} target * @return {number[]} */ var twoSum = function (nums, target) { for (let i = 0; i < nums.length - 1; .. 2022. 11. 22.
[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.