Tap here to switch tabs
Problem
Submissions

Problem: Smallest Missing Integer Above Sequential Prefix Sum

Try to solve the Smallest Missing Integer Greater Than Sequential Prefix Sum problem.

Statement

You are given an integer array nums.

A prefix of nums is called sequential if each element in the prefix, starting from index 11, is exactly 11 greater than the element immediately preceding it. That is, a prefix nums[0..k] is sequential if nums[i] = nums[i - 1] + 1 for all 1≤i≤k1 \leq i \leq k. A prefix containing only a single element is always sequential.

Find the sum of the longest sequential prefix of nums. Let this sum be SS.

Return the smallest integer xx such that x≥Sx \geq S and xx is not present in nums.

Constraints:

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

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Smallest Missing Integer Above Sequential Prefix Sum

Try to solve the Smallest Missing Integer Greater Than Sequential Prefix Sum problem.

Statement

You are given an integer array nums.

A prefix of nums is called sequential if each element in the prefix, starting from index 11, is exactly 11 greater than the element immediately preceding it. That is, a prefix nums[0..k] is sequential if nums[i] = nums[i - 1] + 1 for all 1≤i≤k1 \leq i \leq k. A prefix containing only a single element is always sequential.

Find the sum of the longest sequential prefix of nums. Let this sum be SS.

Return the smallest integer xx such that x≥Sx \geq S and xx is not present in nums.

Constraints:

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

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