My Software Engineering

My Software Engineering

  • 분류 전체보기 (94)
    • Leetcode (93)
  • 홈
  • Leetcode
RSS 피드
로그인
로그아웃 글쓰기 관리

My Software Engineering

컨텐츠 검색

태그

최근글

댓글

공지사항

아카이브

Leetcode(93)

  • 105. Construct Binary Tree from Preorder and Inorder Traversal

    Description: Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree. # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right ''' [1] divide and set) ..

    2021.11.15
  • 572. Subtree of Another Tree

    Description: Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise. A subtree of a binary tree tree is a tree that consists of a node in tree and all of this node's descendants. The tree tree could also be considered as a subtree of itself. # Definition for a binary tree node. # class..

    2021.11.15
  • 102. Binary Tree Level Order Traversal

    Description: Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level). # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right ''' [1] using queue) code:: from collections import deque class Solution: def levelOrder(..

    2021.11.14
  • 104. Maximum Depth of Binary Tree

    Description: Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right ''' [1] bottom-up) code:: def maxDe..

    2021.11.12
  • 100. Same Tree

    Description: Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right ''' [1] top-down) idea:: check whet..

    2021.11.12
  • 143. Reorder List

    Description: You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on the following form: L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → … You may not modify the values in the list's nodes. Only nodes themselves may be changed. # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.va..

    2021.11.12
1 2 3 4 5 6 ··· 16
티스토리
© 2018 TISTORY. All rights reserved.

티스토리툴바