LeetCode342 leetcode 1122. Relative Sort Array https://leetcode.com/problems/relative-sort-array/description/ Relative Sort Array - LeetCode Can you solve this real interview question? Relative Sort Array - Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1. Sort the elements of arr1 such that the relative ordering of items in arr1 are t leetcode.com 1 2 3 4 5 6 7 8 9 class Solution: .. 2023. 3. 13. leetcode 2395. Find Subarrays With Equal Sum https://leetcode.com/problems/find-subarrays-with-equal-sum/description/ Find Subarrays With Equal Sum - LeetCode Can you solve this real interview question? Find Subarrays With Equal Sum - Given a 0-indexed integer array nums, determine whether there exist two subarrays of length 2 with equal sum. Note that the two subarrays must begin at different indices. Return tr leetcode.com 1 2 3 4 5 6 7 .. 2023. 3. 13. leetcode 2451. Odd String Difference https://leetcode.com/problems/odd-string-difference/description/ Odd String Difference - LeetCode Can you solve this real interview question? Odd String Difference - You are given an array of equal-length strings words. Assume that the length of each string is n. Each string words[i] can be converted into a difference integer array difference[i] of len leetcode.com 1 2 3 4 5 6 7 8 9 10 11 12 13 .. 2023. 3. 8. leetcode 2264. Largest 3-Same-Digit Number in String https://leetcode.com/problems/largest-3-same-digit-number-in-string/description/ Largest 3-Same-Digit Number in String - LeetCode Can you solve this real interview question? Largest 3-Same-Digit Number in String - You are given a string num representing a large integer. An integer is good if it meets the following conditions: * It is a substring of num with length 3. * It consists of leetcode.co.. 2023. 3. 7. leetcode 2549. Count Distinct Numbers on Board https://leetcode.com/problems/count-distinct-numbers-on-board/description/ Count Distinct Numbers on Board - LeetCode Can you solve this real interview question? Count Distinct Numbers on Board - You are given a positive integer n, that is initially placed on a board. Every day, for 109 days, you perform the following procedure: * For each number x present on the board, f leetcode.com 1 2 3 4 5 .. 2023. 3. 7. leetcode 1539. Kth Missing Positive Number https://leetcode.com/problems/kth-missing-positive-number/description/ Kth Missing Positive Number - LeetCode Can you solve this real interview question? Kth Missing Positive Number - Given an array arr of positive integers sorted in a strictly increasing order, and an integer k. Return the kth positive integer that is missing from this array. Example 1: Input: leetcode.com 1 2 3 4 5 6 7 8 9 10 .. 2023. 3. 6. leetcode 2164. Sort Even and Odd Indices Independently https://leetcode.com/problems/sort-even-and-odd-indices-independently/description/ Sort Even and Odd Indices Independently - LeetCode Can you solve this real interview question? Sort Even and Odd Indices Independently - You are given a 0-indexed integer array nums. Rearrange the values of nums according to the following rules: 1. Sort the values at odd indices of nums in non-increasing o leetcod.. 2023. 3. 3. leetcode 203. Remove Linked List Elements https://leetcode.com/problems/remove-linked-list-elements/description/ Remove Linked List Elements - LeetCode Can you solve this real interview question? Remove Linked List Elements - Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head. Example 1: [https://assets.leetcode. leetcode.com 1 2 3 4 5 6 7 8 9 10 .. 2023. 2. 28. leetcode 1290. Convert Binary Number in a Linked List to Integer https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer/description/ Convert Binary Number in a Linked List to Integer - LeetCode Can you solve this real interview question? Convert Binary Number in a Linked List to Integer - Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the .. 2023. 2. 28. leetcode 2574. Left and Right Sum Differences https://leetcode.com/problems/left-and-right-sum-differences/description/ 1 2 3 4 5 6 7 8 9 10 11 12 13 class Solution: def leftRigthDifference(self, nums: List[int]) -> List[int]: nums.append(0) left_sum = 0 right_sum = sum(nums) - nums[0] answer = [] for i in range(len(nums)-1): answer.append(abs(left_sum-right_sum)) left_sum+=nums[i] right_sum -= nums[i+1] return answer Colored by Color Scrip.. 2023. 2. 28. 백준 27541 末尾の文字 (Last Letter) https://www.acmicpc.net/problem/27541 27541번: 末尾の文字 (Last Letter) 葵が見た文字列 JOI の末尾の文字は G でないので,葵は末尾に文字 G を付け加えた文字列 JOIG を思い浮かべる.そのため,JOIG を出力する. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 def sol(n, s) -> str: if s[-1] == 'G': return s[:n - 1] else: return s + 'G' if __name__ == '__main__': n = int(input()) s = str(input()) print(sol(n, s)) cs 슬라이싱을 활용해서 주어진 문자열의 마지막 글자가 'G'로 끝나는지 확인하면 됩니다. Using.. 2023. 2. 24. leetcode 232. Implement Queue using Stacks https://leetcode.com/problems/implement-queue-using-stacks/description/ Implement Queue using Stacks - LeetCode Implement Queue using Stacks - Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty). Implement the MyQueue class: * void push(int x) Pushes leetcode.com 1 2 3 4 5 6 7 8 9.. 2023. 2. 23. 이전 1 ··· 7 8 9 10 11 12 13 ··· 29 다음