[LeetCode] House Robber
·
공부/코딩테스트 | 알고리즘
문제You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjacent houses were broken into on the same night.Given an integer array nums representing the amount of mone..
[LeetCode] Maximum Subarray
·
공부/코딩테스트 | 알고리즘
문제Given an integer array nums, find the subarray with the largest sum, and return its sum. 예시Input: nums = [-2,1,-3,4,-1,2,1,-5,4]Output: 6Explanation: The subarray [4,-1,2,1] has the largest sum 6.Input: nums = [1]Output: 1Explanation: The subarray [1] has the largest sum 1.Input: nums = [5,4,-1,7,8]Output: 23Explanation: The subarray [5,4,-1,7,8] has the largest sum 23.풀기우선 난 못풀었다(..)내가 생각한 방법..
[LeetCode] Climbing Stairs
·
공부/코딩테스트 | 알고리즘
문제문제You are climbing a staircase. It takes n steps to reach the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? 예시Input: n = 2Output: 2Explanation: There are two ways to climb to the top.1. 1 step + 1 step2. 2 stepsInput: n = 3Output: 3Explanation: There are three ways to climb to the top.1. 1 step + 1 step + 1 step2. 1 step + 2 steps3. 2 step..
[프로그래머스] 입양 시각 구하기(2)
·
공부/코딩테스트 | 알고리즘
코딩테스트 연습 - 입양 시각 구하기(2) ANIMAL_OUTS 테이블은 동물 보호소에서 입양 보낸 동물의 정보를 담은 테이블입니다. ANIMAL_OUTS 테이블 구조는 다음과 같으며, ANIMAL_ID, ANIMAL_TYPE, DATETIME, NAME, SEX_UPON_OUTCOME는 각각 동물의 아이디, 생물 programmers.co.kr 프로그래머스 코딩테스트 SQL 문제를 풀며 정리하는 내용입니다. 환경은 MySQL로 설정했습니다 😃 문제 및 결과 예시 풀이 과정 SELECT HOUR(DATETIME) AS HOUR , COUNT(*) AS COUNT FROM ANIMAL_OUTS WHERE HOUR(DATETIME) BETWEEN 0 AND 23 GROUP BY HOUR(DATETIME) O..