自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 收藏
  • 关注

Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.这题我写的太难看了,就直接看网上copy下来的吧,具体是哪里copy过来的我忘记了。几天的思想就是分治。[code="java"]/** * Definition for singly-lin...

2015-03-12 19:55:46 77

Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()...

2015-03-12 19:50:22 87

Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all valid ...

2015-03-05 22:33:52 82

Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end,...

2015-03-05 22:31:31 88

Letter Combinations of a Phone Number

Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone butt...

2015-03-05 22:30:11 100

原创 4Sum

Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Elements in a...

2015-03-05 22:26:36 62

原创 3Sum Closest

Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly...

2015-03-05 22:25:24 71

3Sum

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c) must...

2015-03-03 22:34:24 87

Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.额,这个暴力点就成[code="java"] public String longestCommonPrefix(String[] strs) { String result = ""; ...

2015-03-03 22:21:58 71

Roman to Integer

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.这个和之前的相比就是倒序一下[code="java"] public int romanToInt(String s) { int result = 0...

2015-03-03 22:20:37 74

原创 Integer to Roman

Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.数字转换为罗马数字,而且还限制了最大值,所以用一个很取巧的方式。[code="java"] public String intToRoman(int num) ...

2015-03-01 23:35:29 64

Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two ...

2015-03-01 22:55:58 59

Regular Expression Matching

Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire inp...

2015-03-01 20:19:24 73

Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.判断是否为回文数,比较简单,可以用两种方式做,一种是用java中的stringbuffer的一个反转函数,一种直接判断数字。后一种效率比较高。前者代码量少点。1:public class Solution { public boo...

2015-02-13 22:08:03 65

原创 String to Integer (atoi)

Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca...

2015-02-13 11:07:12 89

原创 Reverse Integer

Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.这题挺简单的,我用了一个比较取巧的方式。效率不会太高。可以用普通的方式来做,那样效率会高很多。public class Solution { ...

2015-02-12 23:39:38 77

原创 ZigZag Conversion

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I...

2015-02-12 23:37:07 71

原创 Longest Palindromic Substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.寻找最长的回文字符串。用的是一个比较简单的方式。...

2015-02-12 22:50:07 75

原创 Add Two Numbers

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...

2015-02-12 22:12:55 68

原创 Longest Substring Without Repeating Characters

[size=24px;]Longest Substring Without Repeating Characters[/size] Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without ...

2015-02-11 21:14:57 72

原创 Median of Two Sorted Arrays

There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).看到这题,本来是想寻找每一部分的中间值进行分治想法来解决的。但是写了半...

2015-02-10 23:12:19 61

原创 two sum

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 numbers such that they add up to the target, whe...

2015-02-09 22:55:32 82

原创 实习日记6

今天是元旦来上班的第一天,因为公司可以选择周五来还是周日来,所以今天来的人比较少。今天总体来没有做些什么,更加了解了下系统,并且去熟悉了一个新的框架。jackson,一个用来转换java和jason代码的框架。

2015-01-04 19:06:11 458

原创 实习日记5

昨天是因为一些个人的原因没有更新。真是不应该。今天也是不太忙,自己在看了一些关于structs1 的一些东西,然后在努力看懂整个系统中的一个响应。这个系统太大了,开发的人也非常之多,导致很多实现方式都有,没有一个统一的方式。边上的同事也不太清楚具体应该从哪里找。在数据库中看了一下,了解了他们所说的基本上的东西都配在数据库中的意思。还有一点很头疼,就是很少有注释,让我看代码的时候总是非常的烦。

2014-12-31 20:34:49 519

原创 实习日记4

今天是周一,办公室的各位来的都不算是太早。又开始看了一天的代码,终于我承认了我是不可能看懂整个代码的,而且很多时候连找到某个代码在哪里都不太可能。果然,这种大的项目和我平时做的小项目是不太一样的。我自己分配的那一个story虽然不是特别大,而且还很依赖别的story,所以今天开始也没有做太多的东西。我开始在些一些test的东西,可以是test的文档。所以最近还是很闲的,这么闲让我很不适应。而且我发

2014-12-29 22:11:54 292

原创 实习日记3

今天是周五,同样,我也是在看代码。是一些比较古老的代码,structs1+spring+hibernate3,很多都没看懂,找一些jsp页面都无法找到,找了近乎一天。之后得知,不是这种实现方式,一些页面的跳转,数据的获取都存储在数据库中,我从来都没见过这种方式。然后前端是用jpgrid来进行一些表格数据的获取,今天刚刚准备看。感觉动力满满啊。

2014-12-26 20:56:09 403

原创 菜鸟程序实习日记2

今天是实习的第二天,得到了svn的权限,将目前自己需要的工作环境布好。今天其实主要的工作还是在开会,开一个review meeting。然后基本没有什么事情。知道了除了maven之外还有Ant+ivy的jar包控制。看了些,并没有太多的理解,然后看了下防洗钱的英文资料,好多没看懂。基本上今天就是这样了。

2014-12-25 19:04:37 595

原创 程序菜鸟的实习日记1

大四开始实习,想记录自己实习的点点滴滴,所以写下这个,如果算是专题的话,希望我能坚持下来。       今天刚刚入职,领了电脑,工牌,填了保密协议,实习协议之类的准备工作,软件也安装了一些。我实习的公司是一个外包公司,主要是做金融方面的外包,具体名字就不说了。       像是一种学校的感觉,边上都是前辈们,都是非常和善的。        我这个项目组是做一个老项目的维护及升级工作,运

2014-12-24 18:44:50 673

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除