Dorito
'알고리즘' 카테고리의 글 목록 (2 Page)

알고리즘

알고리즘/SQL-1

180. Consecutive Numbers

링크: 180. Consecutive Numbers 난이도: Medium 문제 Table: Logs +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | num | varchar | +-------------+---------+ id is the primary key for this table. id is an autoincrement column. Write an SQL query to find all numbers that appear at least three times consecutively. Return the result table in any order. The query result..

알고리즘/프로그래머스

[프로그래머스 Lv2] 롤케이크 자르기 JavaScript 풀이

코딩테스트 연습 - 롤케이크 자르기 | 프로그래머스 스쿨 (programmers.co.kr) 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 첫번째 시도 순차적으로 slice 해서 두 배열을 각자 HashSet로 만든 다음에 개수 비교하는 로직 사용 → 시간 초과 시간 초과 이유: topping의 길이가 최대 1,000,000 이기 때문이다. for 문으로 토핑 배열 전체를 순회하면서 slice, set 으로 중복 걸러내면 시간 복잡도 O(n²)임 두번째 시도: 로직 순서 1. olderBrother → 이름을 가진 Map 객체에 key: 토핑 종류 val..