摘要: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/ 思路解析: 给一个数列,先买后卖。所以是用一个min存一个当前找到的最小值,然后price来loop一遍这个,算差值。 阅读全文
posted @ 2017-11-11 10:32 mandyliu 阅读(113) 评论(0) 推荐(0)
摘要: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
posted @ 2017-09-28 23:22 mandyliu 阅读(96) 评论(0) 推荐(0)
摘要: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex 阅读全文
posted @ 2017-08-29 10:38 mandyliu 阅读(101) 评论(0) 推荐(0)