SSpanKestrel
Product

Product features · Maximum contiguous sum

01

SpanKestrel helps discuss which adjacent observations form the best total, including the indices that distinguish tied answers rather than only their sums.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Maximum contiguous sum

● ● ●SpanKestrel●
A concrete starting point · Maximum contiguous sum ×
def maximum_subarray(values):
    if type(values) not in (list, tuple) or len(values) > 1000 or any(type(v) is not int or abs(v) > 10**9 for v in values):
        raise ValueError("subarray.input")
    if not values:
        return None
    best = None
    total, start = 0, 0
    for end, value in enumerate(values, 1):
        if total < 0:
            total, start = 0, end - 1
        total += value
        candidate = (total, start, end)
        if best is None or (-total, start, end) < (-best[0], best[1], best[2]):
            best = candidate
    return best
✳Find the greatest contiguous sum in at most 1000 integers bounded by one billion in magnitude, returning sum and exclusive bounds.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗