2588.统计美丽子数组数目
地址:2588. 统计美丽子数组数目 - 力扣(LeetCode)
思路
转化为异或+前缀和问题
cnt[0]=1是因为循环中先对ans进行操作,不赋值会丢失恰好异或值为0的情况。
If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you !