2017年11月23日

数组中出现次数超过一半的数字

摘要: 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}。由于数字2在数组中出现了5次,超过数组长度的一半,因此输出2。如果不存在则输出0。 阅读全文

posted @ 2017-11-23 16:35 wsw_seu 阅读(192) 评论(0) 推荐(0) 编辑

Best Time to Buy and Sell Stock I II III IV

摘要: 一、Best Time to Buy and Sell Stock I 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 阅读全文

posted @ 2017-11-23 15:47 wsw_seu 阅读(352) 评论(0) 推荐(0) 编辑

导航