Counting Game

Problem Overview

  • Determine the next valid number Zack should call in a counting game with skip rules.
  • Given input x (Rose’s call), output -1 if x is invalid; otherwise output the next number not forbidden.
  • Numbers are forbidden if they are multiples of 7, contain the digit 7, or are multiples of any number containing 7.
  • Real-world context: a casual counting game variant used to test reasoning.
  • Trend_micro interview question; a classic coding interview problem for a coding interview.

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: