[LeetCode] 1475. Final Prices With a Special Discount in a Shop (Python)
·
알고리즘/LeetCode
난이도: Easy문제 설명You are given an integer array prices where prices[i] is the price of the ith item in a shop. There is a special discount for items in the shop. If you buy the ith item, then you will receive a discount equivalent to prices[j] where j is the minimum index such that j > i and prices[j]  Return an integer array answer where answer[i] is the final price you will pay for the ith item o..
[LeetCode] 2182. Construct String With Repeat Limit (Python)
·
알고리즘/LeetCode
난이도: Medium 문제 설명You are given a string s and an integer repeatLimit. Construct a new string repeatLimitedString using the characters of s such that no letter appears more than repeatLimit times in a row. You do not have to use all characters from s. Return the lexicographically largest repeatLimitedString possible. A string a is lexicographically larger than a string b if in the first position ..
[LeetCode] 3264. Final Array State After K Multiplication Operations I (Python)
·
알고리즘/LeetCode
난이도: Easy 문제 설명You are given an integer array nums, an integer k, and an integer multiplier.You need to perform k operations on nums. In each operation:Find the minimum value x in nums. If there are multiple occurrences of the minimum value, select the one that appears first.Replace the selected minimum value x with x * multiplier.Return an integer array denoting the final state of nums after pe..
[LeetCode] 1792. Maximum Average Pass Ratio (Python)
·
알고리즘/LeetCode
난이도: Medium문제 설명There is a school that has classes of students and each class will be having a final exam. You are given a 2D integer array classes, where classes[i] = [passi, totali]. You know beforehand that in the ith class, there are totali total students, but only passi number of students will pass the exam. You are also given an integer extraStudents. There are another extraStudents brilli..
[LeetCode] 1945. Sum of Digits of String After Convert (Python)
·
알고리즘/LeetCode
난이도: Easy 문제 설명You are given a string s consisting of lowercase English letters, and an integer k. Your task is to convert the string into an integer by a special process, and then transform it by summing its digits repeatedly k times. More specifically, perform the following steps:Convert s into an integer by replacing each letter with its position in the alphabet (i.e. replace 'a' with 1, 'b' ..
[LeetCode] 2593. Find Score of an Array After Marking All Elements (Python)
·
알고리즘/LeetCode
난이도: Medium 문제 설명You are given an array nums consisting of positive integers.Starting with score = 0, apply the following algorithm:Choose the smallest integer of the array that is not marked. If there is a tie, choose the one with the smallest index.Add the value of the chosen integer to score.Mark the chosen element and its two adjacent elements if they exist.Repeat until all the array element..