Jacob avatar

[Leetcode] 100.same-tree

jacobyu

Published: 21 May 2018 › Updated: 21 May 2018[Leetcode] 100.same-tree

[Leetcode] 100.same-tree

문제

풀이 과정

같은 트리인지 어떻게 확인하지?

  1. 트리 구조가 같은지 체크한다.
  2. 두 개의 트리에서 특정 노드의 value가 같은지 체크한다.

탐색 순서는?

  1. preorder로 하자.
  2. 재귀적으로 가자.

Submission Fail

  • []\n[] --> NULL인 경우를 신경 안썼다. --> 런타임 에러 발생
  • [1]\n[] --> 마찬가지이다. -->런타임 에러 발생
  • [1,2,1]\n[1,1,2] --> 트리 구조만 같은지 체크했었다. --> 에러

image.png

일주일에 최소 2개 이상 꾸준히 풀어보고 싶어요!

Leave [Leetcode] 100.same-tree to:

Written by

developer, steemcoinpan dev

Read more #jjangjjangman posts


Best Posts From Jacob

We have not curated any of jacobyu's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Jacob