코딩테스트54 Python ] leetCode 1861 - Rotating the Box 리트코드 1861번 문제 You are given an m x n matrix of characters box representing a side-view of a box. Each cell of the box is one of the following: A stone '#'A stationary obstacle '*'Empty '.' The box is rotated 90 degrees clockwise, causing some of the stones to fall due to gravity. Each stone falls down until it lands on an obstacle, another stone, or the bottom of the box. Gravity does not affect.. 2024. 6. 2. Python ] leetCode 189 - Rotate Array 리트코드 189번 문제 Given an integer array nums, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: nums = [1,2,3,4,5,6,7], k = 3Output: [5,6,7,1,2,3,4]Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,3,4] Example 2: Input: nums = [-1,-100,3,99], k = 2Output: [3,99,-1,-100]E.. 2024. 5. 31. C++ ] leetCode 85 - Maximal Rectangle 리트코드 85번 문제 Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example 1: Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]Output: 6Explanation: The maximal rectangle is shown in the above picture. Example 2: Input: matrix = [["0"]]Output: 0 Example 3: Input: ma.. 2024. 5. 20. C++ ] leetCode 84 - Largest Rectangle in Histogram 리트코드 84번 문제 Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram. Example 1:Input: heights = [2,1,5,6,2,3]Output: 10Explanation: The above is a histogram where width of each bar is 1. The largest rectangle is shown in the red area, which has an area = 10 units. Example 2:Input: he.. 2024. 5. 18. C++ ] leetCode 42 - Trapping Rain Water 리트코드 42번 문제 Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. Example 1: Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] Output: 6 Explanation: The above elevation map (black section) is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped. Examp.. 2024. 5. 14. C++ ] leetCode 937 - Reorder Data in Log Files 리트코드 937번 문제 You are given an array of logs. Each log is a space-delimited string of words, where the first word is the identifier. There are two types of logs: Letter-logs: All words (except the identifier) consist of lowercase English letters. Digit-logs: All words (except the identifier) consist of digits. Reorder these logs so that: The letter-logs come before all digit-logs. The letter-logs.. 2024. 5. 10. C++ ] leetCode 143 - Reorder List 리트코드 143번 문제 You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on the following form: L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → … You may not modify the values in the list's nodes. Only nodes themselves may be changed. Example 1: Input: head = [1,2,3,4] Output: [1,4,2,3] Example 2: Input: head = [1,2,3,4,5] Output: [1,5,2.. 2024. 5. 8. C++ ] leetCode 1195 - Fizz Buzz Multithreaded 리트코드 1195번 문제 You have the four functions: printFizz that prints the word "fizz" to the console, printBuzz that prints the word "buzz" to the console, printFizzBuzz that prints the word "fizzbuzz" to the console, and printNumber that prints a given integer to the console. You are given an instance of the class FizzBuzz that has four functions: fizz, buzz, fizzbuzz and number. The same instance o.. 2024. 5. 6. C++ ] leetCode 784 - Letter Case Permutation Given a string s, you can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible strings we could create. Return the output in any order. Example 1: Input: s = "a1b2" Output: ["a1b2","a1B2","A1b2","A1B2"] Example 2: Input: s = "3z4" Output: ["3z4","3Z4"] Constraints: 1 2024. 4. 30. C++ ] leetCode 1010 - Pairs of Songs With Total Durations Divisible by 60 리트코드 1010 문제 You are given a list of songs where the ith song has a duration of time[i] seconds. Return the number of pairs of songs for which their total duration in seconds is divisible by 60. Formally, we want the number of indices i, j such that i < j with (time[i] + time[j]) % 60 == 0. Example 1: Input: time = [30,20,150,100,40] Output: 3 Explanation: Three pairs have a total duration divis.. 2024. 4. 24. 이전 1 2 3 4 ··· 6 다음