목록PS/LeetCode (583)
넘치게 채우기
https://leetcode.com/problems/remove-all-occurrences-of-a-substring/description/leetcode - Remove All Occurrences of a Substring문제 유형: 스택, 문자열 처리문제 난이도: Medium 문제Given two strings s and part, perform the following operation on s until all occurrences of the substring part are removed:Find the leftmost occurrence of the substring part and remove it from s.Return s after removing all occurrences o..
https://leetcode.com/problems/clear-digits/description/leetcode - Clear Digits문제 유형: 스택, 문자열 처리문제 난이도: Easy 문제You are given a string s.Your task is to remove all digits by doing this operation repeatedly:Delete the first digit and the closest non-digit character to its left.Return the resulting string after removing all digits. 문자열 s를 받습니다.당신의 임무는 다음을 반복적으로 수행하는 것 입니다:첫 번째 숫자를 지우고 왼쪽의 숫자가 아닌 문자를..
https://leetcode.com/problems/count-number-of-bad-pairs/description/leetcode - Count Number of Bad Pairs문제 유형: 투 포인터, 해시, 정렬, 수학문제 난이도: Medium 문제You are given a 0-indexed integer array nums. A pair of indices (i, j) is a bad pair if i and j - i != nums[j] - nums[i].Return the total number of bad pairs in nums. 0-indexed의 정수 배열 nums가 주어진다.(i, j)페어는 다음 조건을 만족하면 나쁜 페어이다: if i 나쁜 페어의 개수를 구하시오. 풀이전체..
https://leetcode.com/problems/design-a-number-container-system/description/leetcode - Design a Number Container System문제 유형: 우선순위 큐, 힙, 해시문제 난이도: Medium 문제Design a number container system that can do the following:Insert or Replace a number at the given index in the system.Return the smallest index for the given number in the system.Implement the NumberContainers class:NumberContainers() Initial..
https://leetcode.com/problems/find-the-number-of-distinct-colors-among-the-balls/description/leetcode - Find the Number of Distinct Colors Among the Balls문제 유형: 해시문제 난이도: Medium 문제You are given an integer limit and a 2D array queries of size n x 2.There are limit + 1 balls with distinct labels in the range [0, limit]. Initially, all balls are uncolored. For every query in queries that is of the ..
https://leetcode.com/problems/tuple-with-same-product/description/leetcode - Tuple with Same Product문제 유형: 수학, 해시문제 난이도: Medium 문제Given an array nums of distinct positive integers, return the number of tuples (a, b, c, d) such that a * b = c * d where a, b, c, and d are elements of nums, and a != b != c != d. 독립적인 정수 배열 nums가 주어집니다.a*b = c*d인 (a, b, c, d)튜플조합의 개수를 모두 구하시오. 풀이하나의 조합을 구하면, 8개의 튜플을..
https://leetcode.com/problems/check-if-one-string-swap-can-make-strings-equal/description/leetcode - Check if One String Swap Can Make Strings Equal문제 유형: 투 포인터문제 난이도: Easy 문제You are given two strings s1 and s2 of equal length. A string swap is an operation where you choose two indices in a string (not necessarily different) and swap the characters at these indices.Return true if it is possible ..
https://leetcode.com/problems/maximum-ascending-subarray-sum/description/leetcode - Maximum Ascending Subarray Sum문제 유형: 슬라이딩 윈도우문제 난이도: Easy 문제Given an array of positive integers nums, return the maximum possible sum of an ascending subarray in nums.A subarray is defined as a contiguous sequence of numbers in an array.A subarray [numsl, numsl+1, ..., numsr-1, numsr] is ascending if for all i wh..
https://leetcode.com/problems/longest-strictly-increasing-or-strictly-decreasing-subarray/description/leetcode - Longest Strictly Increasing or Strictly Decreasing Subarray문제 유형: 슬라이딩 윈도우문제 난이도: Easy 문제You are given an array of integers nums. Return the length of the longest subarray of nums which is either strictly increasing or strictly decreasing. 정수 배열 nums가 주어진다. 가장 긴 오름차순 또는 내림차순 부분배열의 길이를..
https://leetcode.com/problems/check-if-array-is-sorted-and-rotated/description/leetcode - Check if Array Is Sorted and Rotated문제 유형: 배열, 구현문제 난이도: Easy 문제Given an array nums, return true if the array was originally sorted in non-decreasing order, then rotated some number of positions (including zero). Otherwise, return false.There may be duplicates in the original array.Note: An array A rotated ..