摘要: At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and order one at a time (in the order specified by bil 阅读全文
posted @ 2019-03-25 21:36 月半榨菜 阅读(68) 评论(0) 推荐(0) 编辑
摘要: Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a g 阅读全文
posted @ 2019-03-25 21:13 月半榨菜 阅读(76) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2019-03-25 21:00 月半榨菜 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of lowercase English letters only and the 阅读全文
posted @ 2019-03-25 20:17 月半榨菜 阅读(227) 评论(0) 推荐(0) 编辑
摘要: Implement pow(x, n), which calculates x raised to the power n (xn). Example 1: Example 2: Example 3: Note: -100.0 < x < 100.0 n is a 32-bit signed int 阅读全文
posted @ 2019-03-25 15:46 月半榨菜 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2019-03-25 11:32 月半榨菜 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2019-03-25 10:56 月半榨菜 阅读(133) 评论(0) 推荐(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 阅读全文
posted @ 2019-03-25 10:31 月半榨菜 阅读(135) 评论(0) 推荐(0) 编辑