Skip to content

Create monotonic_array.py #11025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update monotonic_array.py
  • Loading branch information
Khushi-Shukla authored Oct 27, 2023
commit 82b4c59f94befbbff589d36d0ff5e3b4d3471aa7
8 changes: 5 additions & 3 deletions data_structures/arrays/monotonic_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def is_monotonic(nums: list[int]) -> bool:


# Test the function with your examples
print(is_monotonic([1, 2, 2, 3])) # Output: True
print(is_monotonic([6, 5, 4, 4])) # Output: True
print(is_monotonic([1, 3, 2])) # Output: False
if __name__ == "__main__":
# Test the function with your examples
print(is_monotonic([1, 2, 2, 3])) # Output: True
print(is_monotonic([6, 5, 4, 4])) # Output: True
print(is_monotonic([1, 3, 2])) # Output: False