{"id":23143038,"url":"https://github.com/prakhar-002/leetcode","last_synced_at":"2025-08-03T16:38:35.991Z","repository":{"id":241319329,"uuid":"805285844","full_name":"Prakhar-002/LEETCODE","owner":"Prakhar-002","description":"📜 LeetCode Solution Hub 🔥 | Get all solutions 🧩 for daily challenges and specific tasks 💪🏻 | Example: 🍨 LeetCode 75 - 🪻 Ace Coding Interview, 📦 SQL 50 - 🌽 Crack SQL Interview, 📒 30 Days of JavaScript - 🌻 Learn JS Basics","archived":false,"fork":false,"pushed_at":"2025-06-16T04:25:18.000Z","size":3931,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-16T05:27:23.245Z","etag":null,"topics":["c","cpp","java","javascript","leet","leetcode","leetcode-cpp","leetcode-java","leetcode-javascript","leetcode-practice","leetcode-python","leetcode-solutions","python3","questions-and-answers"],"latest_commit_sha":null,"homepage":"https://leetcode.com/u/Prakhar-002/","language":"Java","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/Prakhar-002.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}},"created_at":"2024-05-24T09:01:02.000Z","updated_at":"2025-06-16T04:25:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"69e95c7a-6944-456b-bd7a-72104cc7fcdb","html_url":"https://github.com/Prakhar-002/LEETCODE","commit_stats":null,"previous_names":["prakhar-002/leetcode"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Prakhar-002/LEETCODE","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prakhar-002%2FLEETCODE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prakhar-002%2FLEETCODE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prakhar-002%2FLEETCODE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prakhar-002%2FLEETCODE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Prakhar-002","download_url":"https://codeload.github.com/Prakhar-002/LEETCODE/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prakhar-002%2FLEETCODE/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260571682,"owners_count":23029927,"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","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":["c","cpp","java","javascript","leet","leetcode","leetcode-cpp","leetcode-java","leetcode-javascript","leetcode-practice","leetcode-python","leetcode-solutions","python3","questions-and-answers"],"created_at":"2024-12-17T15:11:52.506Z","updated_at":"2025-06-18T14:36:54.544Z","avatar_url":"https://github.com/Prakhar-002.png","language":"Java","readme":"# 689. Maximum Sum of 3 Non-Overlapping Subarrays\n\n\u003c/br\u003e\n\n\u003ch2 align=\"center\"\u003e \n\n\u003ca href=\"https://leetcode.com/problems/maximum-sum-of-3-non-overlapping-subarrays/description/?envType=daily-question\u0026envId=2024-12-28\"\u003e\u003cstrong\u003e➥ ☢️ 689 Leetcode Medium ☢️ \u003c/strong\u003e\u003c/a\u003e\n\u003c/h2\u003e\n\n\u003c/br\u003e\n\n# Description 📜 ˋ°•*⁀➷\n\n### Given an integer array `nums` and an integer `k`, find three non-overlapping subarrays of length `k` with maximum sum and return them.\n\n### Return the result as a list of indices representing the starting position of each interval (0-indexed). If there are multiple answers, return the lexicographically smallest one.\n\n\u003c/br\u003e\n\n# Example 💡 1️⃣ ˋ°•*⁀➷\n\n  ### 📥 `Input`  ➤  nums = [1,2,1,2,6,7,5,1], k = 2\n\n  ### 📤 `Output`  ➤ [0,3,5]\n\n  ### 🔦 `Explanation`  ➤ Subarrays [1, 2], [2, 6], [7, 5] correspond to the starting indices [0, 3, 5].\u003c/br\u003e We could have also taken [2, 1], but an answer of [1, 3, 5] would be lexicographically larger.\n\n\u003c/br\u003e\n\n# Example 💡 2️⃣ ˋ°•*⁀➷\n\n  ### 📥 `Input` ➤ nums = [1,2,1,2,1,2,1,2,1], k = 2\n\n  ### 📤 `Output`  ➤ [0,2,4]\n\n\u003c/br\u003e\n\n# Constraints 🔒 ˋ°•*⁀➷\n\n🔹 **1 \u003c= nums.length \u003c= 2 * 10\u003csup\u003e4\u003c/sup\u003e** \u003c/br\u003e\n\n🔹 **1 \u003c= nums[i] \u003c 2\u003csup\u003e16\u003c/sup\u003e** \u003c/br\u003e\n\n🔹 **`1 \u003c= k \u003c= floor(nums.length / 3)`** \u003c/br\u003e\n\n\u003c/br\u003e\n\n# Topics 📋 ˋ°•*⁀➷\n\n🔸 **Array**  \u003c/br\u003e\n🔸 **Dynamic Programming**  \u003c/br\u003e\n\n\u003c/br\u003e\n\n# Solution ✏️ ˋ°•*⁀➷\n\n| 📒 Language 📒  | 🪶 Solution 🪶 |\n| ------------- | ------------- |\n|  ![Java](https://img.shields.io/badge/java-%23ED8B00.svg?style=for-the-badge\u0026logo=openjdk\u0026logoColor=white)  | [JAVA🍁](https://github.com/Prakhar-002/LEETCODE/blob/main/%F0%9F%93%9C%20Daily%20Challange%20%F0%9F%92%A1/12%20December%20%F0%9F%90%BB%E2%80%8D%E2%9D%84%EF%B8%8F%202024/28%20-%2012%20-%202024%20---%20689.%20Maximum%20Sum%20of%203%20Non-Overlapping%20Subarrays%20%E2%98%83%EF%B8%8F%20%F0%9F%8D%81%20%F0%9F%8D%B0%20%F0%9F%8E%B2/%F0%9F%8D%81JAVA%20-%20689.%20Maximum%20Sum%20of%203%20Non-Overlapping%20Subarrays.java) |\n|  ![C++](https://img.shields.io/badge/c++-%2300599C.svg?style=for-the-badge\u0026logo=c%2B%2B\u0026logoColor=white)  | [C++🎲](https://github.com/Prakhar-002/LEETCODE/blob/main/%F0%9F%93%9C%20Daily%20Challange%20%F0%9F%92%A1/12%20December%20%F0%9F%90%BB%E2%80%8D%E2%9D%84%EF%B8%8F%202024/28%20-%2012%20-%202024%20---%20689.%20Maximum%20Sum%20of%203%20Non-Overlapping%20Subarrays%20%E2%98%83%EF%B8%8F%20%F0%9F%8D%81%20%F0%9F%8D%B0%20%F0%9F%8E%B2/%F0%9F%8E%B2CPP%20-%20689.%20Maximum%20Sum%20of%203%20Non-Overlapping%20Subarrays.cpp)  |\n|  ![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54)    | [PYTHON🍰](https://github.com/Prakhar-002/LEETCODE/blob/main/%F0%9F%93%9C%20Daily%20Challange%20%F0%9F%92%A1/12%20December%20%F0%9F%90%BB%E2%80%8D%E2%9D%84%EF%B8%8F%202024/28%20-%2012%20-%202024%20---%20689.%20Maximum%20Sum%20of%203%20Non-Overlapping%20Subarrays%20%E2%98%83%EF%B8%8F%20%F0%9F%8D%81%20%F0%9F%8D%B0%20%F0%9F%8E%B2/%F0%9F%8D%B0PYTHON%20-%20689.%20Maximum%20Sum%20of%203%20Non-Overlapping%20Subarrays.py) |\n| ![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge\u0026logo=javascript\u0026logoColor=%23F7DF1E)   | [JAVASCRIPT☃️](https://github.com/Prakhar-002/LEETCODE/blob/main/%F0%9F%93%9C%20Daily%20Challange%20%F0%9F%92%A1/12%20December%20%F0%9F%90%BB%E2%80%8D%E2%9D%84%EF%B8%8F%202024/28%20-%2012%20-%202024%20---%20689.%20Maximum%20Sum%20of%203%20Non-Overlapping%20Subarrays%20%E2%98%83%EF%B8%8F%20%F0%9F%8D%81%20%F0%9F%8D%B0%20%F0%9F%8E%B2/%E2%98%83%EF%B8%8FJAVASCRIPT%20-%20689.%20Maximum%20Sum%20of%203%20Non-Overlapping%20Subarrays.js) |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprakhar-002%2Fleetcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprakhar-002%2Fleetcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprakhar-002%2Fleetcode/lists"}