Back to Practice Dashboard
DSA SectionEasy

Deletions

Learn how to solve the 'Deletions' problem. This detailed resource details brute force and optimized approaches.

Problem Statement

Easy

Write a function delete_node(arr, pos) that represents a linked list as a Python list arr. Delete the node at the 0-based index pos and return the updated list.

Constraints
  • 1 <= len(arr) <= 1000
  • 0 <= pos < len(arr)

Examples

Example 1
Input
arr = [1, 5, 2, 3], pos = 1
Output
[1, 2, 3]
Explanation

We delete the element at index 1, which is 5.

Need a Hint?
Analyze the input constraints. Try sorting first (O(n log n)) or using a hash map/set to track seen elements in O(n) time.
Edge Cases to Watch
  • Empty list or null input variables
  • Single item lists/arrays
  • Extremely large input bounds causing integer or stack overflow

Ready to Solve?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

Open in Editor