摘要:
这个课程的参考视频和图片来自youtube。 主要学到的知识点有: 1. Nested If-else statement (if-else ladder) 2. Switch 3. Enumerations An enumeration custom data type that enables 阅读全文
阅读排行榜
[LeetCode] 696. Count Binary Substrings_Easy
2018-08-20 02:09 by Johnson_强生仔仔, 258 阅读, 收藏,
摘要:
利用group, 将每个连着的0或者1计数并且append进入group里面, 然后再将group里面的两两比较, 得到min, 并且加入到ans即可. T: O(n) S: O(n) 比较好理解 improve: 思路相同, 用pre和cur去将space节省到O(1) Code 1) T: O( 阅读全文
[LeetCode] 98. Validate Binary Search Tree_Medium
2018-07-22 09:50 by Johnson_强生仔仔, 258 阅读, 收藏,
摘要:
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] 859. Buddy Strings_Easy
2018-08-20 09:59 by Johnson_强生仔仔, 257 阅读, 收藏,
摘要:
Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B. Example 1: Input: 阅读全文
[LeetCode] 236. Lowest Common Ancestor of a Binary Tree_ Medium tag: DFS, Divide and conquer
2019-04-19 06:07 by Johnson_强生仔仔, 256 阅读, 收藏,
摘要:
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文
浙公网安备 33010602011771号