- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# 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 Questions & Answers
- 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
- Python Indices of numbers greater than K
- Python program to split string into k distinct partitions
- Python – Average of digit greater than K
- Python - Consecutive Ranges of K greater than N
- Program to check whether list is strictly increasing or strictly decreasing in Python
- Python - Number of values greater than K in list
- 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

Advertisements