{"id":22513658,"url":"https://github.com/emahtab/monotonic-array","last_synced_at":"2026-02-25T17:40:37.550Z","repository":{"id":79525660,"uuid":"230055287","full_name":"eMahtab/monotonic-array","owner":"eMahtab","description":null,"archived":false,"fork":false,"pushed_at":"2019-12-25T06:45:40.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-28T15:51:59.817Z","etag":null,"topics":["leetcode","monotonic-array","problem-solving"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eMahtab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-25T06:42:59.000Z","updated_at":"2019-12-25T06:46:28.000Z","dependencies_parsed_at":"2023-05-10T17:30:26.596Z","dependency_job_id":null,"html_url":"https://github.com/eMahtab/monotonic-array","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eMahtab/monotonic-array","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fmonotonic-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fmonotonic-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fmonotonic-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fmonotonic-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eMahtab","download_url":"https://codeload.github.com/eMahtab/monotonic-array/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fmonotonic-array/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281467275,"owners_count":26506462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["leetcode","monotonic-array","problem-solving"],"created_at":"2024-12-07T03:13:56.564Z","updated_at":"2025-10-28T15:52:00.564Z","avatar_url":"https://github.com/eMahtab.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Monotonic Array\n\nAn array is monotonic if it is either monotone increasing or monotone decreasing.\n\nAn array A is monotone increasing if for all i \u003c= j, A[i] \u003c= A[j].  \nAn array A is monotone decreasing if for all i \u003c= j, A[i] \u003e= A[j].\n\nReturn true if and only if the given array A is monotonic.\n\n``` \n\nExample 1:\n\nInput: [1,2,2,3]\nOutput: true\n\nExample 2:\n\nInput: [6,5,4,4]\nOutput: true\n\nExample 3:\n\nInput: [1,3,2]\nOutput: false\n\nExample 4:\n\nInput: [1,2,4,5]\nOutput: true\n\nExample 5:\n\nInput: [1,1,1]\nOutput: true\n```\n\n### Implementation\n\n```java\npublic boolean isMonotonic(int[] A) {\n        if(A == null){\n            return false;\n        }\n        if(A.length \u003c= 1){\n            return true;\n        }\n        \n        boolean increasing = true;\n        boolean decreasing = true;\n        \n        for(int i = 0; i \u003c A.length - 1; i++){\n            if(A[i] \u003e A[i+1]){\n                increasing = false;\n            }\n            if(A[i] \u003c A[i+1]){\n                decreasing = false;\n            }\n        }\n        \n    return increasing || decreasing;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Fmonotonic-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femahtab%2Fmonotonic-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Fmonotonic-array/lists"}