Number of Distinct Roll Sequences at ServiceNow
Hard58.1% acceptance
This problem has 87.5% frequency at ServiceNow.
Problem Description
You are given an integer `n`. You roll a fair 6-sided dice `n` times. Determine the total number of **distinct** sequences of rolls possible such that the following conditions are satisfied: 1. The **greatest common divisor** of any **adjacent** values in the sequence is equal to `1`. 2. There...
Read full problem and hintsTopics
More ServiceNow Questions
Trapping Rain WaterHardGenerate ParenthesesMediumBest Time to Buy and Sell StockEasyMaximum Product SubarrayMediumMaximal SquareMedium
View all ServiceNow questions