일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- MySQL
- presignedurl
- 유노코딩
- HTML
- 파이썬프로그래밍기초
- 코딩테스트준비
- SQL
- 엘리스sw트랙
- 항해99
- nestjs
- Cookie
- TiL
- 개발자취업
- 꿀단집
- 파이썬
- 데이터베이스시스템
- CSS
- 코드잇
- 프로그래머스
- 코딩테스트
- node.js
- Python
- 방송대컴퓨터과학과
- 99클럽
- JavaScript
- 중간이들
- aws
- Git
- redis
- 방송대
- Today
- Total
목록프로그래머스 (51)
배꼽파지 않도록 잘 개발해요

const fs = require('fs');const data = fs.readFileSync('/dev/stdin').toString().trim().split('\n');const [M, N, K] = data[0].split(' ').map(Number);const rectangles = data.slice(1).map(line => line.split(' ').map(Number));function findAreasOfSeparatedRegions(M, N, rectangles) { let grid = Array.from({ length: M }, () => Array(N).fill(0)); rectangles.forEach(([x1, y1, x2, y2]) => { fo..

function countSheepGroups(grid, H, W) { const directions = [ [-1, 0], [1, 0], [0, -1], [0, 1] ]; function dfs(x, y) { if (x = H || y = W) return; if (grid[x][y] !== '#') return; grid[x][y] = '.'; for (let [dx, dy] of directions) { dfs(x + dx, y + dy); } } let sheepGroupCount = 0; for (let i = 0; i

/** * Definition for a binary tree node. * function TreeNode(val, left, right) { * this.val = (val===undefined ? 0 : val) * this.left = (left===undefined ? null : left) * this.right = (right===undefined ? null : right) * } *//** * @param {TreeNode} root * @param {number} distance * @return {number} */var countPairs = function(root, distance) { let result = 0; function dfs(node)..

function numIslands(grid) { if (grid.length === 0) return 0; const directions = [ [-1, 0], [1, 0], [0, -1], [0, 1], [-1, -1], [-1, 1], [1, -1], [1, 1] ]; let count = 0; function dfs(x, y) { if (x = grid.length || y >= grid[0].length || grid[x][y] === '0') { return; } grid[x][y] = '0'; // Mark this cell as visited by setting it to '0' ..

function calculateDistances(N, connections) { // 트리 구조를 초기화 const tree = new Map(); for (let i = 1; i 0) { const current_pipe = queue.shift(); const current_distance = distance[current_pipe]; // 연결된 모든 파이프를 순회 for (const child of tree.get(current_pipe)) { if (distance[child] === -1) { // 아직 방문하지 않은 경우 distance[child] = curr..

공식을 찾으면 간단히 풀 수 있다.하지만 나는 이렇게 안 풀었다. 추후 업로드 예정import mathclass Solution: def arrangeCoins(self, n: int) -> int: k = int((-1 + math.sqrt(1 + 8 * n)) // 2) return k

/** * @param {number[]} nums * @return {number} */var missingNumber = function(nums) { let n = nums.length; // 배열의 길이 let arr = []; // 0부터 n까지 있는 배열 // 0부터 n까지 찾기 for (let i = 0; i !nums.includes(el))};

function solution(priorities, location) { // 큐를 우선순위와 인덱스를 포함하는 배열로 반환 let queue = priorities.map((priority, idx) => ({ priority, idx })); console.log(queue)// [// { priority: 2, idx: 0 },// { priority: 1, idx: 1 },// { priority: 3, idx: 2 },// { priority: 2, idx: 3 }// ] let printOrder = 0; // 몇 번째로 실행되는지 카운트 while (queue.length > 0) { let current = queue.shift..

function solution(park, routes) { // 방향을 벡터 이동으로 매핑 const directionMap = { 'N': [-1, 0], // 북쪽: x축 -1, y축 변화 없음 'S': [1, 0], // 남쪽: x축 +1, y축 변화 없음 'W': [0, -1], // 서쪽: x축 변화 없음, y축 -1 'E': [0, 1] // 동쪽: x축 변화 없음, y축 +1 }; // 시작 위치 찾기 let startX, startY; for (let i = 0; i = park.length || // 공원을 벗어나는지 확인 newY = park[0].length |..