2016年4月27日
摘要: 问题描述: 在股市的交易日中,假设最多可进行两次买卖(即买和卖的次数均小于等于2),规则是必须一笔成交后进行另一笔(即买-卖-买-卖的顺序进行)。给出一天中的股票变化序列,请写一个程序计算一天可以获得的最大收益。请采用实践复杂度低的方法实现。 给定价格序列prices及它的长度n,请返回最大收益。保 阅读全文
posted @ 2016-04-27 16:47 zehua_tongxini 阅读(665) 评论(0) 推荐(0)
摘要: Question: Find the contiguous subarray within an array (containing at least one number) that has the largest sum. For example, given the array [2, 1, 阅读全文
posted @ 2016-04-27 13:39 zehua_tongxini 阅读(325) 评论(0) 推荐(0)
  2016年4月25日
摘要: 问题描述:有10个整数,使前面各数顺序向后移m个位置,最后m个数变成最前面m个数,计算移动后的整数序列的前m个和后m个数的和 对于此题来说,没必要用while(cin.hasNext()),因为知道输入的数字个数了,可以直接进行读取的,如下面所示: 阅读全文
posted @ 2016-04-25 19:30 zehua_tongxini 阅读(125) 评论(0) 推荐(0)
  2016年4月23日
摘要: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng 阅读全文
posted @ 2016-04-23 10:48 zehua_tongxini 阅读(125) 评论(0) 推荐(0)
摘要: Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true 解决方案: 注:e9 -> false ; 1. -> 阅读全文
posted @ 2016-04-23 08:29 zehua_tongxini 阅读(287) 评论(0) 推荐(0)
  2016年4月19日
摘要: Leetcode里面关于字符串的一些问题,描述如下: Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the". U 阅读全文
posted @ 2016-04-19 22:17 zehua_tongxini 阅读(476) 评论(0) 推荐(0)
摘要: Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 注:直接看题目可能会有些偏差,因为容易认为 ne 阅读全文
posted @ 2016-04-19 14:36 zehua_tongxini 阅读(176) 评论(0) 推荐(0)
摘要: Question: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man, a plan, a 阅读全文
posted @ 2016-04-19 09:38 zehua_tongxini 阅读(272) 评论(0) 推荐(0)
  2015年12月9日
摘要: 机器学习其实在2000年(即上一轮计算机火热的时候就出现的),无关什么,只是现在硬件上来了,数据更多了,人们又开始关注它了,所以从适应潮流的角度,这是我们得知道的,毕竟现在用的多。理论的研究是艰难地,所以大部分人都会选择去学习怎么用它,充分利用的成果,数据集处理、分类算法、特征学习算法应该是这里面比... 阅读全文
posted @ 2015-12-09 10:45 zehua_tongxini 阅读(103) 评论(0) 推荐(0)