原文链接: https://leetcode-cn.com/problems/maximum-score-words-formed-by-letters 英文原文Given a list of words, list of single letters (might be repeating) and score of every character. Return the maximum score of any valid set of words formed by using the g…
标签详情
位运算 分类
原文链接: https://leetcode-cn.com/problems/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix 英文原文Given a m x n binary matrix mat. In one step, you can choose one cell and flip it and all the four neighbors of it if they exist (Flip is chang…
原文链接: https://leetcode-cn.com/problems/xor-queries-of-a-subarray 英文原文You are given an array arr of positive integers. You are also given the array queries where queries[i] = [lefti, righti]. For each query i compute the XOR of elements from lefti to …
原文链接: https://leetcode-cn.com/problems/minimum-flips-to-make-a-or-b-equal-to-c 英文原文Given 3 positives numbers a, b and c. Return the minimum flips required in some bits of a and b to make ( a OR b == c ). (bitwise OR operation). Flip operation consist…
原文链接: https://leetcode-cn.com/problems/number-of-steps-to-reduce-a-number-to-zero 英文原文Given an integer num, return the number of steps to reduce it to zero. In one step, if the current number is even, you have to divide it by 2, otherwise, you have t…
原文链接: https://leetcode-cn.com/problems/sort-integers-by-the-number-of-1-bits 英文原文Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more …
原文链接: https://leetcode-cn.com/problems/maximum-students-taking-exam 英文原文Given a m * n matrix seats that represent seats distributions in a classroom. If a seat is broken, it is denoted by '#' character otherwise it is denoted by a '.' character. Stud…
原文链接: https://leetcode-cn.com/problems/find-the-longest-substring-containing-vowels-in-even-counts 英文原文Given the string s, return the size of the longest substring containing each vowel an even number of times. That is, 'a', 'e', 'i', 'o', and 'u' mu…
原文链接: https://leetcode-cn.com/problems/cinema-seat-allocation 英文原文 A cinema has n rows of seats, numbered from 1 to n and there are ten seats in each row, labelled from 1 to 10 as shown in the figure above. Given the array reservedSeats containing th…
原文链接: https://leetcode-cn.com/problems/number-of-steps-to-reduce-a-number-in-binary-representation-to-one 英文原文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 …
原文链接: https://leetcode-cn.com/problems/number-of-ways-to-wear-different-hats-to-each-other 英文原文There are n people and 40 types of hats labeled from 1 to 40. Given a list of list of integers hats, where hats[i] is a list of all hats preferred by the i…
原文链接: https://leetcode-cn.com/problems/count-triplets-that-can-form-two-arrays-of-equal-xor 英文原文Given an array of integers arr. We want to select three indices i, j and k where (0 <= i < j <= k < arr.length). Let's define a and b as follows: a = arr[…
原文链接: https://leetcode-cn.com/problems/check-if-a-string-contains-all-binary-codes-of-size-k 英文原文Given a binary string s and an integer k. Return true if every binary code of length k is a substring of s. Otherwise, return false. Example 1: Input: s …
原文链接: https://leetcode-cn.com/problems/pseudo-palindromic-paths-in-a-binary-tree 英文原文Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be pseudo-palindromic if at least one permutation of the node valu…
原文链接: https://leetcode-cn.com/problems/parallel-courses-ii 英文原文You are given an integer n, which indicates that there are n courses labeled from 1 to n. You are also given an array relations where relations[i] = [prevCoursei, nextCoursei], representi…
原文链接: https://leetcode-cn.com/problems/xor-operation-in-an-array 英文原文Given an integer n and an integer start. Define an array nums where nums[i] = start + 2*i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums. Example 1…
原文链接: https://leetcode-cn.com/problems/number-of-good-ways-to-split-a-string 英文原文You are given a string s, a split is called good if you can split s into 2 non-empty strings p and q where its concatenation is equal to s and the number of distinct let…
原文链接: https://leetcode-cn.com/problems/find-longest-awesome-substring 英文原文Given a string s. An awesome substring is a non-empty substring of s such that we can make any number of swaps in order to make it palindrome. Return the length of the maximum …
原文链接: https://leetcode-cn.com/problems/minimum-cost-to-connect-two-groups-of-points 英文原文You are given two groups of points where the first group has size1 points, the second group has size2 points, and size1 >= size2. The cost of the connection betwe…
原文链接: https://leetcode-cn.com/problems/maximum-number-of-achievable-transfer-requests 英文原文We have n buildings numbered from 0 to n - 1. Each building has a number of employees. It's transfer season, and some employees want to change the building they…
原文链接: https://leetcode-cn.com/problems/minimum-one-bit-operations-to-make-integers-zero 英文原文Given an integer n, you must transform it into 0 using the following operations any number of times: Change the rightmost (0th) bit in the binary representati…
原文链接: https://leetcode-cn.com/problems/count-subtrees-with-max-distance-between-cities 英文原文There are n cities numbered from 1 to n. You are given an array edges of size n-1, where edges[i] = [ui, vi] represents a bidirectional edge between cities ui …
原文链接: https://leetcode-cn.com/problems/distribute-repeating-integers 英文原文You are given an array of n integers, nums, where there are at most 50 unique values in the array. You are also given an array of m customer order quantities, quantity, where qu…
原文链接: https://leetcode-cn.com/problems/maximize-grid-happiness 英文原文You are given four integers, m, n, introvertsCount, and extrovertsCount. You have an m x n grid, and there are two types of people: introverts and extroverts. There are introvertsCoun…
原文链接: https://leetcode-cn.com/problems/minimum-xor-sum-of-two-arrays 英文原文You are given two integer arrays nums1 and nums2 of length n. The XOR sum of the two integer arrays is (nums1[0] XOR nums2[0]) + (nums1[1] XOR nums2[1]) + ... + (nums1[n - 1] XO…
原文链接: https://leetcode-cn.com/problems/sum-of-all-subset-xor-totals 英文原文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. Giv…
原文链接: https://leetcode-cn.com/problems/number-of-wonderful-substrings 英文原文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…
原文链接: https://leetcode-cn.com/problems/maximum-compatibility-score-sum 英文原文There is a survey that consists of n questions where each question's answer is either 0 (no) or 1 (yes). The survey was given to m students numbered from 0 to m - 1 and m ment…
原文链接: https://leetcode-cn.com/problems/the-number-of-good-subsets 英文原文You are given an integer array nums. We call a subset of nums good if its product can be represented as a product of one or more distinct prime numbers. For example, if nums = [1, …
原文链接: https://leetcode-cn.com/problems/maximum-product-of-the-length-of-two-palindromic-subsequences 英文原文Given a string s, find two disjoint palindromic subsequences of s such that the product of their lengths is maximized. The two subsequences are d…