Minji Log
close
프로필 배경
프로필 로고

Minji Log

  • 분류 전체보기 (65)
    • HTML&CSS (2)
    • Javascript (12)
    • Typescript (1)
    • React (6)
    • Next.js (2)
    • Node.js (2)
    • 코딩문제풀기 (20)
    • 기타 (1)
    • 🔥 프로젝트 (16)
    • 🐞 버그 모음 (2)
    • ✏️ 끄적끄적 (1)
  • 홈
  • 방명록

[프로그래머스/12931] 자릿수 더하기

문제https://school.programmers.co.kr/learn/courses/30/lessons/12931 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 풀이법자연수 N 의 각 자리의 합을 구해라 → 자연수를 배열로 변경해서 배열을 돌면서 요소들을 더하면 되겠다! 하고 생각했다. 우선 자연수를 배열로 변경하려면 문자열로 먼저 변경하는 과정이 필요하다. 문자열로 변경 후 문자열을 배열로 변경하는 것은 Array.from() 을 사용하였고, 배열을 순회하면서 모든 요소를 더하는 것은 reduce() 를 사용하였다. 코드const solution = (..

  • format_list_bulleted 코딩문제풀기
  • · 2024. 7. 18.
  • textsms

[프로그래머스] 두 수의 차

문제https://school.programmers.co.kr/learn/courses/30/lessons/120803?language=javascript 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 코드function solution(num1, num2) { return num1 - num2;} 시간복잡도num1 과 num2 을 빼는 연산은 상수 시간을 소요한다. 따라서 시간복잡도는 O(1)이다. 즉, 입력 크기와 관계없이 일정한 시간이 소요된다.해당 코드에서는 두 개의 숫자를 입력받고, 두 숫자에 대한 단순 뺄셈 연산만 실행한다. 따라서 입력되는 ..

  • format_list_bulleted 코딩문제풀기
  • · 2024. 6. 5.
  • textsms

[백준/10828] 스택

문제https://www.acmicpc.net/problem/10828 정답const fs = require("fs");const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt";const input = fs.readFileSync(filePath).toString().split("\n");class Stack { #array; constructor(array = []) { this.#array = array; } push(value) { return this.#array.push(value); } pop() { if (this.#array.length === 0) { return -1; ..

  • format_list_bulleted 코딩문제풀기
  • · 2024. 6. 5.
  • textsms

[백준/10430] 나머지

문제https://www.acmicpc.net/problem/10430 정답const fs = require("fs");const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt";const input = fs.readFileSync(filePath).toString().split(" ");const numberArr = input.map((i) => parseInt(i));function solution(input) { const A = input[0]; const B = input[1]; const C = input[2]; console.log((A + B) % C); console.log(((A % C) + (B ..

  • format_list_bulleted 코딩문제풀기
  • · 2024. 6. 2.
  • textsms

[백준 | 1874 | 자바스크립트] 스택 수열

문제https://www.acmicpc.net/problem/1874 정답 코드const fs = require("fs");const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt";const input = fs .readFileSync(filePath) .toString() .split("\n") .map((i) => Number(i));function solution(input) { const result = []; const count = input[0]; const stack = []; let stackNumber = 1; for (let i = 1; i  풀이문제를 읽고 어떻게 풀라는 것인지 이해가 안..

  • format_list_bulleted 코딩문제풀기
  • · 2024. 5. 26.
  • textsms

[백준] 2753 | 윤년 | Javacsript

문제https://www.acmicpc.net/problem/2753 정답 코드const fs = require("fs");const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt";const input = fs.readFileSync(filePath).toString().trim();const isLeapYear = (year) => { if (year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0)) { return true; } else { return false; }};/** * 연도가 주어졌을 때 * 윤년이면 1 출력 * 아니면 0 출력 */function ..

  • format_list_bulleted 코딩문제풀기
  • · 2024. 5. 11.
  • textsms
  • navigate_before
  • 1
  • 2
  • 3
  • 4
  • navigate_next
전체 카테고리
  • 분류 전체보기 (65)
    • HTML&CSS (2)
    • Javascript (12)
    • Typescript (1)
    • React (6)
    • Next.js (2)
    • Node.js (2)
    • 코딩문제풀기 (20)
    • 기타 (1)
    • 🔥 프로젝트 (16)
    • 🐞 버그 모음 (2)
    • ✏️ 끄적끄적 (1)
Copyright © 쭈미로운 생활 All rights reserved.
Designed by JJuum

티스토리툴바