- 博客(14)
- 收藏
- 关注
原创 LeetCode.209 Minimum Size Subarray Sum
该题与Ch_02最长子序列类似,采用聪明算法,详情参考Ch_02最长子序列题目:Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't
2017-08-31 22:17:30 157
原创 LeetCode.26(80) Remove Duplicates from Sorted Array
题目:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in pla
2017-08-31 16:08:47 145
原创 Ch_02 算法分析(最大子序列问题)
需求:最大子序列问题 给定(可能有负的)整数A1,A2..An,求最大子序列之和。(为了方便起见,如果所有整数均为负数,则最大子序列和为0) 例如:对于输入-2,11,-4,13,-5,-2,答案为20(从A2 到A4)算法分析:算法1:该算法肯定会正确运行,运行时间为O(n*3)(最简单,但是也是运行最慢的算法,后面会讲解原因)class Solution
2017-08-28 11:34:45 294
原创 LeetCode.152 Maximum Product Subarray
题目: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],the contiguous subarray [2,3]
2017-08-28 10:52:28 161
原创 LeetCode.36 Valid Sudoku
题目:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partia
2017-08-27 11:46:20 176
原创 LeetCode.38 Count and Say
题目:The count-and-say sequence is the sequence of integers with the first five terms as following1. 12. 113. 214. 12115. 1112211 is read off as "one 1" or 11.11
2017-08-27 11:39:46 174
原创 LeetCode.46(47,31) Permutations && II && Next Permutation(经典的对数列求组合问题)
题目46:Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]分析...
2017-08-27 11:26:31 243
原创 LeetCode.82(83) Remove Duplicates from Sorted List
83.Remove Duplicates from Sorted List题目:Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2
2017-08-27 11:22:39 201
原创 LeetCode.58 Length of Last Word
题目:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.注意事项:
2017-08-27 11:13:41 184
原创 LeetCode.66 Plus One
题目:Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.T
2017-08-26 22:24:52 174
原创 springmvc和struts2的区别
1、springmvc基于方法开发的,struts2基于类开发的。springmvc将url和controller方法映射。映射成功后springmvc生成一个Handler对象,对象中只包括了一个method。 方法执行结束,形参数据销毁。 springmvc的controller开发类似service开发。2、springmvc可以进行单例开发,并且建议使用单例开发,struts2通过类的成
2017-08-25 10:42:54 166
原创 Ch_01 引论
1.Mod运算(非常耗时) n%10=n-「n/10」*10;//向下取整 2.JDK5中Object泛型不能使用基本类型赋值(int等),必须使用引用类型(Integer等)。 3.泛型类型的实例化 不能创建一个泛型类型的实例。如果T是一个类型变量,则语句 T obj =new T(); //右边是非法的 是非法的。 4.递归四条基本法
2017-08-16 21:57:20 281
转载 CentOS 7配置MySQL
CentOS7默认数据库是mariadb,配置等用着不习惯,因此决定改成mysql,但是CentOS7的yum源中默认好像是没有mysql的。为了解决这个问题,我们要先下载mysql的repo源。1.下载mysql的repo源$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm2.安装mysql-community
2017-08-11 10:47:20 287
原创 CentOS7mini配置Tomcat
步骤1: 下载tomcat.tar.gz,如图所示: 步骤2:使用FTP传输工具,传输到CentOS主机中,解压到/home目录下,命令如下: 移动文件: 重命名: 解压: 配置环境: 此时我们进入到tomcat里面的bin目录,执行startup.sh文件即可启动服务器(./ 命令就是运行命令,如果文件是
2017-08-11 10:35:08 300 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人