🚀 Given an integer array nums, find the contiguous subarray (containing at least one number) that has the largest sum and return both its sum and the starting and ending indices of this subarray.
Example 1: Input: nums = [-2, 1, -3, 4, -1, 2, 1, -5, 4] Output: Sum = 6, Subarray Indices = [3, 6] Explanation: The subarray [4, -1, 2, 1] has the largest sum = 6. The starting index of this subarray is 3 and the ending index is 6.
Example 2: Input: nums = [5, -12, 3, 2, 9, -10, 4] Output: Sum = 14, Subarray Indices = [2, 4] Explanation: The subarray [3, 2, 9] has the largest sum = 14. The starting index of this subarray is 2 and the ending index is 4.
🚀 Challenge Constraints Array Size: The input array may contain up to 10^6 integers. Number Range: The integers in the input array will range from -2,147 to 2,147. Non-Empty Subarray: Every valid input array will contain at least one integer.
📤 Submission Guidelines Fork the Repository: Begin by forking the challenge repository. This will be your staging ground for greatness. Code Your Solution: In your chosen high-performance language. Remember, efficiency is key! Naming Convention: Name your solution file using the following convention: <your_name>_solution.* (replace <your_name> with your actual name and * with the appropriate file extension for your language). Merge Request: Once you're confident in your epic solution, submit it by creating a merge request to the original repository. Make sure your merge request title is clear and descriptive. All merge requests will remain open and un-merged until Monday morning.
🏆 Winner Selection Criteria Correctness: Solutions must pass all provided test cases, proving their ability to handle a wide range of input scenarios effectively. Performance: Among the correct solutions, the crown will go to the one with the fastest execution time. Prepare to push the limits of efficiency! Code Elegance (Tiebreaker): In the event of a tie in execution time, the solution with fewer lines of code will be deemed superior, reflecting not only raw speed but also the elegance and readability of the code.
🕒 Submission Deadline All merge requests must be submitted by Sunday night at midnight.