Count Integer Sequences

Problem Overview

  • Count the number of length-N integer sequences with elements in [0, M] whose XOR equals X.
  • Input: N, M, X; output the count modulo 998244353.
  • Domain: bitwise XOR and combinatorial counting on arrays.
  • Asked in Xperi interviews; a coding interview problem and interview question for assessing reasoning.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: