摘要: 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 @ 2017-09-29 12:40 bernieloveslife 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the rans 阅读全文
posted @ 2017-09-29 10:58 bernieloveslife 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Invert a binary tree. to Trivia: This problem was inspired by this original tweet by Max Howell: Python Solution: 阅读全文
posted @ 2017-09-29 10:44 bernieloveslife 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2017-09-29 10:23 bernieloveslife 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The length 阅读全文
posted @ 2017-09-29 10:09 bernieloveslife 阅读(157) 评论(0) 推荐(0) 编辑