InterviewDigestInterviewDigest

OA Practice Workspace

Technical2026-08-16

valid parenthesis length with and without using stack

AI-Expanded — inferred from the question title, not from the original candidate report

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Provide two separate implementations: one using a stack to track indices and another using a two-pass counter approach that operates in constant space.

Context & Summary

Interview Round 1 with questions on DSA, OS, and DBMS

💻 Coding practice works best on desktop.
Code editors are too cramped on mobile screens.