---
title: "Discussion on \"Leetcode - 1372. Longest ZigZag Path in a Binary Tree\" | Hashnode"
description: "Discussion on \"Leetcode - 1372. Longest ZigZag Path in a Binary Tree\". Question / Problem: Leetcode\nSolution\nclass Solution {\n    int find(TreeNode root, int isLeft, int count){\n        if(root == null) return count;\n        if(isLeft == 1) \n            return Math.max(find(root.right,0,count+1), find(root.left,1,0));\n ..."
url: "https://hashnode.com/posts/leetcode-1372-longest-zigzag-path-in-a-binary-tree/643f7b66a58e78b1dd86584b"
---

[Feed](https://hashnode.com/feed) /

Discussion

[Dhayal Ram](https://hashnode.com/@dhayalram)

Learn, Teach and Grow

Apr 19, 2023

# [Leetcode - 1372. Longest ZigZag Path in a Binary Tree](https://dhayalram.hashnode.dev/leetcode-1372-longest-zigzag-path-in-a-binary-tree?utm_source=hashnode&utm_medium=feed)

Question / Problem: Leetcode Solution class Solution { int find(TreeNode root, int isLeft, int count){ if(root == null) return count; if(isLeft == 1) return Math.max(find(root.right,0,count+1), find(root.left,1,0)); ...

dhayalram.hashnode.dev 1 min read

[#leetcode](https://hashnode.com/tag/leetcode) [#leetcode-solution](https://hashnode.com/tag/leetcode-solution) [#algorithms](https://hashnode.com/tag/algorithms) [#leetcodedaily](https://hashnode.com/tag/leetcodedaily)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
