Skip to main content
Practice

remove-minimum

---
id: remove-minimum
title: Removing the Smallest Number - Problem Solution
description: Implement a function to remove the smallest number from a list of integers
tags:
- Python
- List
sidebar_position: 16
isPublic: false
---

# Removing the Smallest Number - Problem Solution

Explore three ways to remove the smallest number from a list of integers.

<br />

```python title="Method 1"
def solution(arr):
if not arr or len(arr) <= 1: # If list is empty or has only one element
return [-1] # Return [-1]
arr.remove(min(arr)) # Remove the smallest number
return arr

Usage Example

Input and Output Example
result = solution([4, 3, 2, 1])
print(result) # Output: [4, 3, 2]

result = solution([10])
print(result) # Output: [-1]

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.