본문 바로가기

Coding Test190

[LeetCode] (Array) Lv Easy. Best Time to Buy and Sell Stock II https://leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/564/ 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[]} prices * @return {number} */ var maxProfit = function (price.. 2023. 1. 16.
[Programmers] Lv 1. 기사단원의 무기 https://school.programmers.co.kr/learn/courses/30/lessons/136798 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(number, limit, power) { let a = 0; for (let cur = 1; cur 2023. 1. 15.
[Programmers] Lv 1. 명예의 전당(1) https://school.programmers.co.kr/learn/courses/30/lessons/138477 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(k, score) { var award = []; return score.reduce((a, element) => { if (k > award.length) { award.push(element); award.sort((a, b) => a - b); } else if (element >= award.at(0)) { award.push(element); award... 2023. 1. 15.
[LeetCode] (Array) Lv Easy. Remove Duplicates from Sorted Array https://leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/727/ 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[]} nums * @return {number} */ var removeDuplicates = function(n.. 2023. 1. 14.
[Programmers] Lv 1. 문자열 나누기 https://school.programmers.co.kr/learn/courses/30/lessons/140108 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(s) { var first; var countArr = new Array(3).fill(0); [...s].forEach((element, index) => { first ||= element; if (element === first) ++countArr[0]; else ++countArr[1]; if (countArr[0] === countArr[1]) { ++.. 2023. 1. 14.
[LeetCode] (Array) Lv Easy. Find Target Indices After Sorting Array https://leetcode.com/problems/find-target-indices-after-sorting-array/description/ Find Target Indices After Sorting Array - LeetCode Find Target Indices After Sorting Array - You are given a 0-indexed integer array nums and a target element target. A target index is an index i such that nums[i] == target. Return a list of the target indices of nums after sorting nums in non-decreasing o leetcod.. 2023. 1. 12.
[Baekjoon] 자바스크립트로 백준 세팅하기 코딩테스트 시작을 위한 여정 백준은 자바스크립트를 지원하지 않는다. node.js를 써야 하는데 문제의 입출력을 직접 해줘야 한다. vs code로 실행하려면 설정해줘야 한다. 문제 해결 node.js 설치하기 (vs code 테스트용) node.js를 다운받는다 : https://nodejs.org/ko/download/ VS code > 확장 프로그램 설치 > Code Runner 설치 테스트 코드로 잘 설치되었는지 확인! 참고: https://webnautes.tistory.com/1473 입출력을 위한 코드 작성하기 fs 방식과 readline 방식이 있다고 하는데, 나는 fs 방식으로 일단 해보기로 했다. const fs = require('fs'); let input = fs.readFileS.. 2023. 1. 12.
[Programmers] (2023 KAKAO BLIND RECRUITMENT) Lv 1. 개인정보 수집 유효기간 https://school.programmers.co.kr/learn/courses/30/lessons/150370?language=javascript 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(today, terms, privacies) { var answer = []; const [y, m, d] = today.split(".").map(Number); let db = {}; function cal(day, u) { const [y1, m1, d1] = day.split(".").map(Number); let a =.. 2023. 1. 10.
[Programmers] Lv 1. 가장 가까운 같은 글자 https://school.programmers.co.kr/learn/courses/30/lessons/142086 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(s) { var answer = [-1]; for (let i = 1; i < s.length; ++i){ let index = s.lastIndexOf(s[i], i-1); if (-1 < index) index = i - index; answer.push(index); } return answer; } GitHub : https://github.com/deve.. 2023. 1. 9.
[Programmers] Lv 1. 크기가 작은 부분 문자열 https://school.programmers.co.kr/learn/courses/30/lessons/147355 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(t, p) { var answer = 0; for (let i = 0; i 2023. 1. 9.