목록비트마스킹 (40)
넘치게 채우기
https://leetcode.com/problems/minimum-number-of-k-consecutive-bit-flips/description/leetcode - Minimum Number of K Consecutive Bit Flips문제 유형 : 그리디 / 비트마스킹 / 슬라이딩 윈도우문제 난이도 : Hard 문제You are given a binary array nums and an integer k.A k-bit flip is choosing a subarray of length k from nums and simultaneously changing every 0 in the subarray to 1, and every 1 in the subarray to 0.Return the minim..
https://leetcode.com/problems/single-number-iii/description/leetcode - Single Number III문제 유형 : 비트마스킹문제 난이도 : Medium 문제Given an integer array nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in any order.You must write an algorithm that runs in linear runtime complexity and..
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..
https://leetcode.com/problems/number-of-steps-to-reduce-a-number-in-binary-representation-to-one/description/leetcode - Number of Steps to Reduce a Number in Binary Representation to One문제 유형 : 비트마스킹, 그리디문제 난이도 : Medium 문제Given the binary representation of an integer as a string s, return the number of steps to reduce it to 1 under the following rules:If the current number is even, you have to d..
https://leetcode.com/problems/subsets/description/leetcode - Subsets문제 유형 : dfs, 백트래킹, 재귀, 비트마스킹문제 난이도 : Medium 문제Given an integer array nums of unique elements, return all possible subsets (the power set).The solution set must not contain duplicate subsets. Return the solution in any order. 중복이 없는 요소들의 정수 배열 nums가 주어진다. 모든 부분집합을 만드시오.중복된 부분집합을 허용하지 않습니다.순서는 상관 없습니다. 풀이백트래킹 풀이 - 빈 배열부터 시작해서 이번 인..
https://leetcode.com/problems/sum-of-all-subset-xor-totals/description/leetcode - Sum of All Subset XOR Totals문제 유형 : 비트마스킹문제 난이도 : Easy 문제The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty.For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1.Given an array nums, return the sum of all XOR totals for every subset of nums. Note: ..
https://leetcode.com/problems/find-the-maximum-sum-of-node-values/description/leetcode - Find the Maximum Sum of Node Values문제 유형 : 수학, 비트마스킹, 트리문제 난이도 : Hard 문제There exists an undirected tree with n nodes numbered 0 to n - 1. You are given a 0-indexed 2D integer array edges of length n - 1, where edges[i] = [ui, vi] indicates that there is an edge between nodes ui and vi in the tree. You are al..
https://leetcode.com/problems/number-of-wonderful-substrings/description/leetcode - Number of Wonderful Substrings문제 유형 : 비트마스킹, 비트 조작문제 난이도 : Medium 문제A wonderful string is a string where at most one letter appears an odd number of times.For example, "ccjjc" and "abab" are wonderful, but "ab" is not.Given a string word that consists of the first ten lowercase English letters ('a' through 'j'),..
https://leetcode.com/problems/minimum-number-of-operations-to-make-array-xor-equal-to-k/description/leetcode - Minimum Number of Operations to Make Array XOR Equal to K문제 유형 : 비트마스킹, 비트 조작문제 난이도 : Medium 문제You are given a 0-indexed integer array nums and a positive integer k.You can apply the following operation on the array any number of times:Choose any element of the array and flip a bit in i..
https://leetcode.com/problems/maximum-odd-binary-number/description/ Maximum Odd Binary Number - LeetCode Can you solve this real interview question? Maximum Odd Binary Number - 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 - Maximum Odd Binary Number 문제 유형 : 문자열처리, 비트마스킹, 그리디 문제..