목록부분합 (7)
넘치게 채우기
https://leetcode.com/problems/subarray-sums-divisible-by-k/description/leetcode - Subarray Sums Divisible by K문제 유형 : 부분합문제 난이도 : Medium 문제Given an integer array nums and an integer k, return the number of non-empty subarrays that have a sum divisible by k.A subarray is a contiguous part of an array. 정수배열 nums와 정수 k가 주어진다.길이가 1이상이며 합이 k의배수인 부분배열의 개수를 구하시오. 풀이부분합으로 값을 누적해서 풀어주면 된다.https://riverov..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/Okzwq/btsHThLkUTA/pk0KxZ0xHA0NNKcPtV7eAK/img.png)
https://leetcode.com/problems/continuous-subarray-sum/description/leetcode - Continuous Subarray Sum문제 유형 : 부분합, 수학문제 난이도 : Medium 문제Given an integer array nums and an integer k, return true if nums has a good subarray or false otherwise.A good subarray is a subarray where:its length is at least two, andthe sum of the elements of the subarray is a multiple of k.Note that:A subarray is a contiguo..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bhCZEO/btsHIeBDf1U/7z60gCqEISQSZDQu15aby0/img.png)
https://leetcode.com/problems/count-triplets-that-can-form-two-arrays-of-equal-xor/description/leetcode - Count Triplets That Can Form Two Arrays of Equal XOR문제 유형 : 부분합, 비트마스킹문제 난이도 : Medium 문제Given an array of integers arr.We want to select three indices i, j and k where (0 Let's define a and b as follows:a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]Note that..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/RNb55/btsFPoAmj8x/8OYnZCXr1lh2Q18upzWEXK/img.png)
https://leetcode.com/problems/contiguous-array/description/ Leetcode - Contiguous Array 문제 유형 : 부분합, 해시 문제 난이도 : Medium 문제 Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1. 바이너리 배열 nums가 주어진다. 0과 1의 개수가 같은 부분배열의 최대 길이를 구하시오. 풀이 부분합을 이용하여 풀 수 있다. 해시맵을 만들어서 총합-인덱스의 형태로 저장한다. 배열을 순회하면서, 총합에 0이면 -1을, 1이면 1을 추가한다. 만약 총합이 0이라면, 처음부터 i인덱스까지 조..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/22Fee/btsD2w1tFFf/rqKli1dPmw9vPoHkR9u8xk/img.png)
https://leetcode.com/problems/number-of-submatrices-that-sum-to-target/description/?envType=daily-question&envId=2024-01-28 LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com LeetCode - Number of Submatrices That Sum to Target..
https://leetcode.com/problems/constrained-subsequence-sum/description/ Constrained Subsequence Sum - LeetCode Can you solve this real interview question? Constrained Subsequence Sum - Given an integer array nums and an integer k, return the maximum sum of a non-empty subsequence of that array such that for every two consecutive integers in the subsequence, nums[i] leetcode.com leetcode - Constra..
https://leetcode.com/problems/minimum-penalty-for-a-shop/description/ Minimum Penalty for a Shop - LeetCode Can you solve this real interview question? Minimum Penalty for a Shop - You are given the customer visit log of a shop represented by a 0-indexed string customers consisting only of characters 'N' and 'Y': * if the ith character is 'Y', it means that cust leetcode.com 문제 유형 : 구간 합(Prefix ..