We will find a way, we always have.

-interstellar

Problem Solving/리트코드 5

[LeetCode] 2563. Count the Number of Fair Pairs

🔈 문제Given a 0-indexed integer array nums of size n and two integers lower and upper, return the number of fair pairs.A pair (i, j) is fair if:0  💫 예시Input: nums = [0,1,7,4,4,5], lower = 3, upper = 6 Output: 6 Explanation: There are 6 fair pairs: (0,3), (0,4), (0,5), (1,3), (1,4), and (1,5). 🎱 제한1 nums.length == n$-10^9$ $-10^9$  📚 문제 풀이 문제를 요약하자면 nums에서 i, j 를 골라(i != j)  더했을 때 lower 보다 같거나 ..

[LeetCode] 3036. Number of Subarrays That Match a Pattern II

🔈 문제 You are given a 0-indexed integer array nums of size n, and a 0-indexed integer array pattern of size m consisting of integers -1, 0, and 1. A subarray nums[i..j] of size m + 1 is said to match the pattern if the following conditions hold for each element pattern[k]: nums[i + k + 1] > nums[i + k] if pattern[k] == 1. nums[i + k + 1] == nums[i + k] if pattern[k] == 0. nums[i + k + 1] < nums[i..

[LeetCode] 1657. Determine if Two Strings Are Close

🔈 문제 Two strings are considered close if you can attain one from the other using the following operations: Operation 1: Swap any two existing characters.For example, abcde -> aecdb Operation 2: Transform every occurrence of one existing character into another existing character, and do the same with the other character. For example, aacabb -> bbcbaa (all a's turn into b's, and all b's turn into ..