← All problemsSign in

3459. Length of Longest V-Shaped Diagonal Segment

LeetCodeArrayDynamic ProgrammingMemoizationMatrixOpen on judge ↗

You are given a 2D integer matrix grid of size n x m, where each element is either 0, 1, or 2. A V-shaped diagonal segment is defined as: - The segment starts with 1. - The subsequent elements follow this infinite sequence: 2, 0, 2, 0, .... - The segment: - Starts along a diagonal direction (top-left to bottom-right, bottom-right to top-left, top-right to bottom-left, or bottom-left to top-ri

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start