본문 바로가기

Coding Test190

[LeetCode] (Sorting and Searching) Lv Easy. First Bad Version https://leetcode.com/explore/interview/card/top-interview-questions-easy/96/sorting-and-searching/774/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com /** * Definition for isBadVersion() * * @param {integer} version num.. 2023. 1. 22.
[LeetCode] (Sorting and Searching) Lv Easy. Merge Sorted Array https://leetcode.com/explore/interview/card/top-interview-questions-easy/96/sorting-and-searching/587/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com /** * @param {number[]} nums1 * @param {number} m * @param {number[].. 2023. 1. 22.
[Programmers] Lv 2. 최솟값 만들기 https://school.programmers.co.kr/learn/courses/30/lessons/12941 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(A, B) { A.sort((a, b) => a - b); B.sort((a, b) => b - a); return A.reduce((acc, e, i) => (acc += e * B[i]), 0); } GitHub : https://github.com/developeSHG/Algorithm-Baekjoon_Programmers/tree/main/%ED%94%84%.. 2023. 1. 22.
[Programmers] Lv 2. JadenCase 문자열 만들기 https://school.programmers.co.kr/learn/courses/30/lessons/12951 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr const solution = (s) => s.split(" ").map((v) => v.charAt(0).toUpperCase() + v.substring(1).toLowerCase()).join(" "); GitHub : https://github.com/developeSHG/Algorithm-Baekjoon_Programmers/tree/main/%ED%94%84%EB%A1%9C%EA%B7%.. 2023. 1. 22.
[Programmers] Lv 2. 최댓값과 최솟값 https://school.programmers.co.kr/learn/courses/30/lessons/12939 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(s) { const arr = s.split(' '); return Math.min(...arr)+' '+Math.max(...arr); } GitHub : https://github.com/developeSHG/Algorithm-Baekjoon_Programmers/tree/main/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8.. 2023. 1. 22.
[Programmers] Lv 2. 점 찍기 https://school.programmers.co.kr/learn/courses/30/lessons/140107 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(k, d) { let answer = 0; const getY = (num) => Math.sqrt(d ** 2 - num ** 2); for (let i = 0; i 2023. 1. 22.
[LeetCode] (Trees) Lv Easy. Maximum Depth of Binary Tree https://leetcode.com/explore/interview/card/top-interview-questions-easy/94/trees/555/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com /** * Definition for a binary tree node. * function TreeNode(val, left, right) { * t.. 2023. 1. 21.
[Programmers] Lv 2. 연속 부분 수열 합의 개수 https://school.programmers.co.kr/learn/courses/30/lessons/131701 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(elements) { var answer = new Set(); elements.forEach((e, i) => { let acc = 0; for (const j in elements) { let idx = (parseInt(j) + i) % elements.length; acc += elements[idx]; answer.add(acc); } }); return.. 2023. 1. 21.
[Programmers Test] (1회차 코딩테스트) No 5. CountEqualWithDividedNumber [문제 설명] 크기가 n인 숫자 배열 nums와 숫자 d가 주어집니다. 0 2023. 1. 20.
[Programmers Test] (1회차 코딩테스트) No 4. BinaryDistance [문제 설명] 0 이상의 정수 n이 주어질 때, n의 이진 표현에서 인접한 두 1 사이의 가장 긴 거리를 출력하는 함수, solution을 완성해주세요. 예를 들어, n이 주어질 때의 결과는 다음과 같습니다. > n : 5 > n의 이진 표현 : 101 > 결과 : 2 > n : 11 > n의 이진 표현 : 1011 > 결과 : 2 [입력 형식] - n은 0 이상 10^9 이하의 정수입니다. [출력 형식] - n의 이진 표현에서 인접한 두 1 사이의 가장 긴 거리를 출력합니다. const solution = (n) => { let itv = 1, max = 1; n.toString(2) .split("") .forEach((e) => { if (e == 0) { ++itv; max = max < itv .. 2023. 1. 20.