- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions

# Program to split lists into strictly increasing sublists of size greater than k in Python

Suppose we have a list of numbers called nums, and another value k, we have to check whether it is possible to split the list into sublists lists such that each sublist has length ≥ k and that is strictly increasing. The list does not need to be split contiguously.

So, if the input is like nums = [6, 7, 5, 10, 13] k = 2, then the output will be True, as the split is [5, 6] and [7, 10, 13].

To solve this, we will follow these steps −

- c := A map that contains elements of nums and its counts
- max_count := maximum of all frequencies of c
- return True when max_count * k <= size of nums otherwise false

## Example (Python)

Let us see the following implementation to get better understanding −

from collections import Counter class Solution: def solve(self, nums, k): c = Counter(nums) max_count = max([v for k, v in c.items()]) return max_count * k <= len(nums) ob = Solution() nums = [6, 7, 5, 10, 13] k = 2 print(ob.solve(nums, k))

## Input

[6, 7, 5, 10, 13], 2

## Output

False

- Related Articles
- Program to check whether list can be split into sublists of k increasing elements in C++
- Program to check whether we can split list into consecutive increasing sublists or not in Python
- Program to find max values of sublists of size k in Python
- Program to find minimum number of operations required to make lists strictly Increasing in python
- Program to maximize the minimum value after increasing K sublists in Python
- Python program to randomly create N Lists of K size
- Program to find number of increasing subsequences of size k in Python
- Program to check whether list is strictly increasing or strictly decreasing in Python
- Python program to split string into k distinct partitions
- Program to find length of contiguous strictly increasing sublist in Python
- Program to check sublist sum is strictly greater than the total sum of given list Python
- Program to find number of K-Length sublists whose average is greater or same as target in python
- Python Indices of numbers greater than K
- Python – Average of digit greater than K
- Python program to split the even and odd elements into two different lists.

Advertisements