Eat Study Love

먹고 공부하고 사랑하라

티스토리챌린지 12

Meeting Room Allocation Problem

Given an array of meeting time intervals intervals where intervals[i] = [starti, endi], return the minimum number of conference rooms required.입출력 예시Example 1:Input: intervals = [[0,30],[5,10],[15,20]]Output: 2Example 2:Input: intervals = [[7,10],[2,4]]Output: 1제약사항1  Leetcode의 meeting room #2 문제이다. 문제확인을 위해 유료결제가 필요하지만 그냥 구글링해서 문제를 긁어왔다. 실습시간에도 사용된 문제이니 함 풀어보자   1. C++쉬운 줄 알고 아래처럼 풀었는데,쉽지 않았다....

Coding_Practice 2024.11.25

Battleships in a Board(Array,Depth-First Search,Matrix)

https://leetcode.com/problems/battleships-in-a-board/description/Given an m x n matrix board where each cell is a battleship 'X' or empty '.', return the number of the battleships on board.Battleships can only be placed horizontally or vertically on board. In other words, they can only be made of the shape 1 x k (1 row, k columns) or k x 1 (k rows, 1 column), where k can be of any size. At least..

Coding_Practice 2024.11.21

Largest Number(Array,String,Greedy,Sorting)

https://leetcode.com/problems/largest-number/description/Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.Since the result may be very large, so you need to return a string instead of an integer. Example 1:Input: nums = [10,2]Output: "210"Example 2:Input: nums = [3,30,34,5,9]Output: "9534330" Constraints:1 0 문제 자체는 일단 설명이 짧아서 좋다. 한 번 D..

Coding_Practice 2024.11.20

Generate Parentheses[String,Dynamic Programming,Backtracking]

https://leetcode.com/problems/generate-parentheses/description/Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1:Input: n = 3Output: ["((()))","(()())","(())()","()(())","()()()"]Example 2:Input: n = 1Output: ["()"] Constraints:1 간단한 Dynamic Programming 코딩 한 번 해보기!문제는 쉬워 보이나, 막상 코딩하려니까 좀 짜친다.  1. Python아래까지 풀다가 GG. 뭔가 뒤에 방법이 생각 안 난다..

Coding_Practice 2024.11.14

Min Cost to Connect All Points(Array,Union Find,Graph,Minimum Spanning Tree)

https://leetcode.com/problems/min-cost-to-connect-all-points/description/You are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi].The cost of connecting two points [xi, yi] and [xj, yj] is the manhattan distance between them: |xi - xj| + |yi - yj|, where |val| denotes the absolute value of val.Return the minimum cost to make all poin..

Coding_Practice 2024.11.12