技术栈

异或操作

Espresso Macchiato
6 小时前
leetcode medium·异或操作·leetcode 3702·leetcode周赛470
Leetcode 3702. Longest Subsequence With Non-Zero Bitwise XOR这一题我们只需要从左往右依次计算每一个位置上的累积异或值即可。其结果只有两种情况:给出python代码实现如下:
Espresso Macchiato
2 年前
树·leetcode hard·leetcode 3069·leetcode双周赛125·异或操作
Leetcode 3068. Find the Maximum Sum of Node Values这一题虽然标记为一道hard的题目,但其实就是一个脑筋急转弯的题目。我们只需要想明白一点即可:因此,我们只需要计算出所有点如果进行异或操作之后可以得到的改变量,然后将其从大到小进行排序,两两配对之后考察最大能够获得多少累积增长即可。
我是有底线的