[LeetCode] Find Xor-Beauty of Array

2527. Find Xor-Beauty of Array

You are given a 0-indexed integer array nums.

The effective value of three indices i, j, and k is defined as ((nums[i] | nums[j]) & nums[k]).

The xor-beauty of the array is the XORing of the effective values of all the possible triplets of indices (i, j, k) where 0 <= i, j, k < n.

Return the xor-beauty of nums.

Read more
[LeetCode] Make Number of Distinct Characters Equal

2531. Make Number of Distinct Characters Equal

You are given two 0-indexed strings word1 and word2.

A move consists of choosing two indices i and j such that 0 <= i < word1.length and 0 <= j < word2.length and swapping word1[i] with word2[j].

Return true if it is possible to get the number of distinct characters in word1 and word2 to be equal with exactly one move. Return false otherwise.

Read more
[LeetCode] Maximize Win From Two Segments

2555. Maximize Win From Two Segments

There are some prizes on the X-axis. You are given an integer array prizePositions that is sorted in non-decreasing order, where prizePositions[i] is the position of the ith prize. There could be different prizes at the same position on the line. You are also given an integer k.

You are allowed to select two segments with integer endpoints. The length of each segment must be k. You will collect all prizes whose position falls within at least one of the two selected segments (including the endpoints of the segments). The two selected segments may intersect.

  • For example if k = 2, you can choose segments [1, 3] and [2, 4], and you will win any prize i that satisfies 1 <= prizePositions[i] <= 3 or 2 <= prizePositions[i] <= 4.

Return the maximum number of prizes you can win if you choose the two segments optimally.

Read more
[AtCoder] E - Count Simple PathsRead more
[AtCoder] D - Make Bipartite 2Read more
[AtCoder] D - Max MultipleRead more
[AtCoder] D - Factorial and MultipleRead more
[AtCoder] C - 暗闇帰り道Read more
[Codeforces] Round #600 (Div. 2) D. Harmonious GraphRead more
[Codeforces] Round #601 (Div. 1) A. Feeding ChickenRead more