Practice Subsequences with a Unique Middle Mode I
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given an integer array nums, find the number of subsequences of size 5 of nums with a unique middle mode. Since the answer may be very large, return it modulo 10^9 + 7. A mode of a sequence of numbers is defined as the element that appears the maximum number of times in the sequence. A sequence of numbers contains a unique mode if it has only one mode. A sequence of numbers seq of size 5 contains a unique middle mode if the middle element (seq[2]) is a unique mode.
Source: Subsequences with a Unique Middle Mode I on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [1,1,1,1,1,1]
6
# Example 2
nums = [1,2,2,3,3,4]
4
# Example 3
nums = [0,1,2,3,4,5,6,7,8]
0
Constraints
Related LeetCode Problems
Practice more problems similar to Subsequences with a Unique Middle Mode I.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.