Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Precompute the XOR score of every subarray.
Try to find a relationship between XOR score of <code>nums[i..j], nums[i..j + 1], nums[i..j + 2], …</code>. Do you notice any pattern?
Solve with full IDE support and test cases
If <code>dp[i][j]</code> is the XOR score of subarray <code>nums[i..j]</code>, <code>dp[i][j] = dp[i - 1][j] XOR dp[i - 1][j + 1]</code>.