代码改变世界

[LeetCode] 230. Kth Smallest Element in a BST_Medium tag: Inorder Traversal

2018-07-24 00:51 by Johnson_强生仔仔, 293 阅读, 0 推荐, 收藏, 编辑
摘要:Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's 阅读全文

[LeetCode] 98. Validate Binary Search Tree_Medium

2018-07-22 09:50 by Johnson_强生仔仔, 249 阅读, 0 推荐, 收藏, 编辑
摘要:Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only 阅读全文

[LeetCode] 590. N-ary Tree Postorder Traversal_Easy

2018-07-22 09:09 by Johnson_强生仔仔, 497 阅读, 0 推荐, 收藏, 编辑
摘要:Given an n-ary tree, return the postorder traversal of its nodes' values. For example, given a 3-ary tree: Return its postorder traversal as: [5,6,3,2 阅读全文

[LeetCode] 429. N-ary Tree Level Order Traversal_ Easy

2018-07-22 04:09 by Johnson_强生仔仔, 564 阅读, 0 推荐, 收藏, 编辑
摘要:Given an n-ary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example, given a 3-ary tree: 阅读全文

[LeetCode] 589. N-ary Tree Preorder Traversal_Easy

2018-07-22 03:55 by Johnson_强生仔仔, 461 阅读, 0 推荐, 收藏, 编辑
摘要:Given an n-ary tree, return the preorder traversal of its nodes' values. For example, given a 3-ary tree: Return its preorder traversal as: [1,3,5,6,2 阅读全文

[LeetCode] questions conlusion_InOrder, PreOrder, PostOrder traversal

2018-07-22 00:03 by Johnson_强生仔仔, 447 阅读, 0 推荐, 收藏, 编辑
摘要:Pre: node 先, Inorder: node in, Postorder: node 最后 PreOrder Inorder PostOrder node-> left -> right left -> node ->right left -> right ->node Recursive 阅读全文

[LeetCode]94, 144, 145 Binary Tree InOrder, PreOrder, PostOrder Traversal_Medium

2018-07-22 00:01 by Johnson_强生仔仔, 158 阅读, 0 推荐, 收藏, 编辑
摘要:Given a binary tree, return the inorder, preorder, postorder traversal of its nodes' values. Example: 这三个题目的思路及总结都在LeetCode questions conlusion_InOrde 阅读全文

[LeetCode] 161. One Edit Distance_Medium

2018-07-20 03:45 by Johnson_强生仔仔, 195 阅读, 0 推荐, 收藏, 编辑
摘要:Given two strings s and t, determine if they are both one edit distance apart. Note: There are 3 possiblities to satisify one edit distance apart: Exa 阅读全文

[LeetCode] 72. Edit Distance_hard tag: Dynamic Programming

2018-07-19 23:59 by Johnson_强生仔仔, 257 阅读, 0 推荐, 收藏, 编辑
摘要:Given two words word1 and word2, find the minimum number of operations required to convert word1to word2. You have the following 3 operations permitte 阅读全文

[LeetCode] 64. Minimum Path Sum_Medium tag: Dynamic Programming

2018-07-19 06:52 by Johnson_强生仔仔, 270 阅读, 0 推荐, 收藏, 编辑
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文