04 2015 档案
摘要:【题目】Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted fr...
阅读全文
摘要:【题目】Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,...
阅读全文
摘要:【题目】Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. Y...
阅读全文
摘要:【题目】Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:El...
阅读全文
摘要:算法基础1.算法的几个特征 有穷性、确定性、输入、输出、可行性2.算法的复杂性定义3.递归算法的定义、递归算法的两要素 定义:一种直接或者间接调用自己的算法 两要素: ①终止条件 ②每次调用的时候,范围会缩小4.分治算法的思想,经典的分治算法(全排列、二分搜索、归并排序、快速排序、...
阅读全文
摘要:一.KMP算法简介 Knuth-Morris-Pratt 字符串查找算法,简称为 “KMP算法”,常用于在一个文本串S内查找一个模式串P 的出现位置,这个算法由Donald Knuth、Vaughan Pratt、James H. Morris三人于1977年联合发表,故取这3人的姓氏命名此算法。...
阅读全文
摘要:1.查看端口使用情况 netstat -apn | grep 8080 关闭端口: kill -9 进程id2.关闭防火墙及selinux (防火墙)重启后永久生效:chkconfig iptables on/off 即时生效:service iptables start/stop (se...
阅读全文
摘要:【题目】Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your ma...
阅读全文
摘要:【题目】Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your ma...
阅读全文
摘要:【问题】Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each num...
阅读全文
摘要:【问题】Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated...
阅读全文
摘要:【题目】Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a functio...
阅读全文
摘要:【题目】Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3, You should return the following ...
阅读全文
摘要:【题目】Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, ...
阅读全文
摘要:一.有序数组的折半查找【步骤】① low=0,high=length-1; //初始值② 当low>high时,返回查找失败信息③ lowa[mid],low=mid+1; //查找在右半区 c.若key=a[mid],返回mid //查找成功【算法实现】public int bi...
阅读全文
摘要:在项目中使用到了Timer,需要定时地执行某些功能。import java.util.Timer;import java.util.TimerTask;public class TestTimer { public static void main(String[] args) { ...
阅读全文
摘要:1.linux登陆ftp ftp 127.0.0.1 端口(默认为21)2.ftp常见返回值 230-用户登陆 425-不能打开数据连接 530-未登录(用户名或密码错误,1、FTP密码修改了?2、用户名/密码输入错误?先仔细检查有无输入错误 如复制的时候误复制了空格!!)
阅读全文
摘要:一.简介BOM(Byte Order Mark)---字节顺序标记。 类似WINDOWS自带的记事本等软件,在保存一个以UTF-8编码的文件时,会在文件开始的地方插入三个不可见的字符(0xEF 0xBB 0xBF,即BOM)。它是一串隐藏的字符,用于让记事本等编辑器识别这个文件是否以UTF-8编码...
阅读全文
摘要:题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target valu...
阅读全文
摘要:题目:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ...
阅读全文
摘要:问题:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space fo...
阅读全文
摘要:题目:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find themaximum profit. You may complete...
阅读全文
摘要:题目:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complet...
阅读全文
摘要:题目:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction ...
阅读全文
摘要:题目:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two...
阅读全文