Skip to content

Commit c464181

Browse files
authored
Fix sorted check for input arrays in merge function
1 parent ea2a6ea commit c464181

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎data_structures/arrays/merge_sorted.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def merge_sorted_arrays(nums1: list[int], nums2: list[int]) -> list[int]:
4242
ValueError: nums = [1, -1] is not sorted
4343
"""
4444
for nums in (nums1, nums2):
45-
if list(nums1) != sorted(nums1):
46-
msg = f"{nums1 = } is not sorted"
45+
if list(nums) != sorted(nums):
46+
msg = f"{nums = } is not sorted"
4747
raise ValueError(msg)
4848
# If one array is empty, simply return the other.
4949
if not nums1:

0 commit comments

Comments
 (0)