본문 바로가기

오블완

(20)
[Leetcode 2955번 문제]2955. Number of Same-End Substrings 문제 상황You are given a 0-indexed string s, and a 2D array of integers queries, where queries[i] = [li, ri] indicates a substring of s starting from the index li and ending at the index ri (both inclusive), i.e. s[li..ri].각각의 쿼리가 subarrayReturn an array ans where ans[i] is the number of same-end substrings of queries[i].same-end?A 0-indexed string t of length n is called same-end if it has the same..
[Leetcode 3133번 문제] 3133. Minimum Array End 문제 상황You are given two integers n and x. You have to construct an array of positive integers nums of size n where for every 0 greater than nums[i], and the result of the bitwise AND operation between all elements of nums is x.Return the minimum possible value of nums[n - 1].n과 x가 주어진다, 배열을 만들어야한다 정수배열 n의 크기를 갖는 nums를 만든다.그 특징은 왼쪽보다 오른쪽이 항상 크다.nums의 배열의 모든 요소 사이의 AND가 x이다.모든 가능한 nums[n - 1]의 값중 가..
[Leetcode 1829번 문제] 1829. Maximum XOR for Each Query 문제 상황You are given a sorted array nums of n non-negative integers and an integer maximumBit. You want to perform the following query n times:Find a non-negative integer k maximized. k is the answer to the ith query.Remove the last element from the current array nums.Return an array answer, where answer[i] is the answer to the ith query.배열이 존재하고 특정한 정수 maximumBit이 있다. 이하의 작업을 n번 반복한다처음부터 끝까지의 요소를..
[Leetcode 2275번 문제] 2275. Largest Combination With Bitwise AND Greater Than Zero 문제 상황The bitwise AND of an array nums is the bitwise AND of all integers in nums.For example, for nums = [1, 5, 3], the bitwise AND is equal to 1 & 5 & 3 = 1.Also, for nums = [7], the bitwise AND is 7.You are given an array of positive integers  candidates.Evaluate the bitwise AND of every combination of numbers of candidates. Each number in candidates may only be used once in each combination.조..