Tap here to switch tabs
Problem
Submissions

Problem: Count Sequences to K

Try to solve the Count Sequences to K problem.

Statement

You are given an integer array nums and an integer k.

Starting with an initial value of 11, you iterate through each element in nums from left to right. For each element nums[i], you must perform exactly one of the following operations on the current value:

  • Multiply the value by nums[i]

  • Divide the value by nums[i]

  • Leave the value unchanged

Return the total number of distinct sequences of choices that result in a final value equal to k.

Constraints:

  • 1≤1 \leq nums.length ≤19\leq 19

  • 1≤1 \leq nums[i] ≤6\leq 6

  • 1≤1 \leq k ≤1015\leq 10^{15}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Sequences to K

Try to solve the Count Sequences to K problem.

Statement

You are given an integer array nums and an integer k.

Starting with an initial value of 11, you iterate through each element in nums from left to right. For each element nums[i], you must perform exactly one of the following operations on the current value:

  • Multiply the value by nums[i]

  • Divide the value by nums[i]

  • Leave the value unchanged

Return the total number of distinct sequences of choices that result in a final value equal to k.

Constraints:

  • 1≤1 \leq nums.length ≤19\leq 19

  • 1≤1 \leq nums[i] ≤6\leq 6

  • 1≤1 \leq k ≤1015\leq 10^{15}