Connection
Base URL, credentials and a reachable server.
SpanKestrel helps discuss which adjacent observations form the best total, including the indices that distinguish tied answers rather than only their sums.
Base URL, credentials and a reachable server.
A model available through the configured endpoint.
Context limits and tool support are determined by the model and server.
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