Spinny OA For SDE-2
378
Aug 11, 2025

Problem 1 — Longest Substring With At Most K Zeros
You are given a binary string s consisting only of '0' and '1', and an integer k.
Return the length of the longest substring of s that contains at most k zero characters.

Problem 2 — Maximum Downward Path Sum in a Tree (Parent Array Representation)

You are given:
An integer array parent of length n, where parent[i] is the parent of node i, and -1 indicates that node i is a root.
An integer array value of length n, where value[i] is the value of node i.
The nodes form a forest (one or more trees).
A downward path is a sequence of nodes starting at some node and moving only to its children repeatedly.

Return the maximum sum of any downward path in the forest.
The path can start at any node and end at any descendant of that node (not necessarily a leaf).
Node values may be negative.

Comments (2)