摘要: 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 @ 2018-12-02 22:24 A-Little-Nut 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Related to question "Excel Sheet Column Title" Given a column title as appear in an Excel sheet, return its corresponding column number. For example: 阅读全文
posted @ 2018-12-02 22:23 A-Little-Nut 阅读(86) 评论(0) 推荐(0) 编辑
摘要: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文
posted @ 2018-12-02 22:21 A-Little-Nut 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 阅读全文
posted @ 2018-12-02 22:20 A-Little-Nut 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文
posted @ 2018-12-02 22:19 A-Little-Nut 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3, 2,4], 阅读全文
posted @ 2018-12-02 22:18 A-Little-Nut 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime comple 阅读全文
posted @ 2018-12-02 22:17 A-Little-Nut 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Given a non empty string s and a dictionary wordDict containing a list of non empty words, determine if s can be segmented into a space separated sequ 阅读全文
posted @ 2018-12-02 22:17 A-Little-Nut 阅读(132) 评论(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 @ 2018-12-02 22:16 A-Little-Nut 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Note: this is a repost(重新投寄) of my original post here with updated solutions(解决方案) for this problem (714. Best Time to Buy and Sell Stock with Transac 阅读全文
posted @ 2018-12-02 22:11 A-Little-Nut 阅读(248) 评论(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 @ 2018-12-02 22:06 A-Little-Nut 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2018-12-02 22:04 A-Little-Nut 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文
posted @ 2018-12-02 22:01 A-Little-Nut 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height balanced binary tree is d 阅读全文
posted @ 2018-12-02 21:58 A-Little-Nut 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the bottom up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root). For 阅读全文
posted @ 2018-12-02 21:57 A-Little-Nut 阅读(108) 评论(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 @ 2018-12-02 21:55 A-Little-Nut 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident 阅读全文
posted @ 2018-12-02 21:52 A-Little-Nut 阅读(139) 评论(0) 推荐(0) 编辑