mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-04-22 13:47:37 +00:00
ruff check fixes
This commit is contained in:
parent
6a9ea4ea67
commit
427b1ca685
@ -1,10 +1,12 @@
|
|||||||
"""
|
"""
|
||||||
Longest Arithmetic Subsequence Problem: Given an array nums of integers, return the length of the longest arithmetic subsequence in nums.
|
Longest Arithmetic Subsequence Problem: Given an array nums of integers, return the length
|
||||||
|
of the longest arithmetic subsequence in nums.
|
||||||
|
|
||||||
Note that:
|
Note that:
|
||||||
- A subsequence is an array that can be derived from another array by deleting some or no elements
|
- A subsequence is an array that can be derived from another array by deleting some or no
|
||||||
without changing the order of the remaining elements.
|
elements without changing the order of the remaining elements.
|
||||||
- A sequence seq is arithmetic if seq[i + 1] - seq[i] are all the same value (for 0 <= i < seq.length - 1).
|
- A sequence seq is arithmetic if seq[i + 1] - seq[i] are all the same value (for 0 <= i <
|
||||||
|
seq.length - 1).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def longest_arithmetic_subsequence(nums: list[int]) -> int:
|
def longest_arithmetic_subsequence(nums: list[int]) -> int:
|
||||||
@ -60,7 +62,7 @@ def longest_arithmetic_subsequence(nums: list[int]) -> int:
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import doctest
|
import doctest
|
||||||
doctest.testmod()
|
doctest.testmod()
|
||||||
# sample test case
|
# Sample test case
|
||||||
nums = [3, 6, 9, 12]
|
nums = [3, 6, 9, 12]
|
||||||
expected_length = 4
|
expected_length = 4
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user