自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(152)
  • 资源 (3)
  • 收藏
  • 关注

原创 Java中,如何让System.out.printf("%d", 2 + 2);输出5

代码如下:import java.lang.reflect.Field;public class TwoPlusTwo { public static void main(String[] args) throws Exception { Class cache = Integer.class.getDeclaredClasses()[0]; System.out.println

2014-11-17 17:08:48 1275

原创 单例模式总结

即时加载public class Singleton { private static final Singleton uniqueInstance = new Singleton(); private Singleton() { } public static Singleton getInstance() { return uniqueInstance; }}延时加载—

2014-09-19 10:24:40 556

原创 IDG | 四则运算表达式计算

分析首先将中缀表达式转换为后缀表达式(逆波兰式),然后使用栈进行计算。代码import java.util.LinkedList;import java.util.List;import java.util.Stack;public class ExpCal { public static double calc(String exp) { if (exp == null

2014-09-18 11:00:04 751

原创 LeetCode | 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:

2014-04-18 16:41:19 584

原创 LeetCode | 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

2014-04-18 14:50:14 574

原创 LeetCode | 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 triple

2014-04-16 18:06:55 710 1

原创 LeetCode | 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)).分析转换为找第K大的数,需要十分小心边界条件。

2014-04-15 11:40:36 604

原创 LeetCode | Longest Common Prefix

题目Write a function to find the longest common prefix string amongst an array of strings.分析按部就班。也可以用高大上的trie树,不过有点大材小用,而且空间、时间都没简单的好。代码public class LongestCommonPrefix { public String lo

2014-04-10 10:55:42 776

原创 LeetCode | 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,

2014-04-10 10:00:00 589

原创 LeetCode | Reverse Integer

题目Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask

2014-04-09 17:38:11 501

原创 LeetCode | 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

2014-04-09 17:14:01 491

原创 LeetCode | Substring with Concatenation of All Words

题目You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and wi

2014-04-09 15:53:47 613

原创 LeetCode | Palindrome Number

题目Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of c

2014-04-09 14:23:10 514

原创 LeetCode | 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

2014-04-08 17:40:14 518

原创 LeetCode | Reverse Nodes in k-Group

题目Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain

2014-04-08 14:54:41 641

原创 LeetCode | Longest Substring Without Repeating Characters

题目Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3

2014-04-08 14:52:25 555

原创 LeetCode | 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 a

2014-04-07 23:09:31 507

原创 LeetCode | 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 tar

2014-04-07 22:40:47 496

原创 LeetCode | 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

2014-04-06 20:08:06 488

原创 LeetCode | Divide Two Integers

题目Divide two integers without using multiplication, division and mod operator.分析逐个减太慢,肯定超时。需要指数级增加后再减,思想类似于Linked List Cycle II中的Brent方法。此外,还要注意零、负数的情况。代码public class DivideTwoIntegers

2014-04-06 20:00:30 2044

原创 LeetCode | Sudoku Solver

题目Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.

2014-04-05 10:40:57 863

原创 LeetCode | 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 partial

2014-04-05 10:38:29 668

原创 LeetCode | 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

2014-04-04 11:57:52 574

原创 LeetCode | Subsets II

题目Given a collection of integers that might contain duplicates, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not conta

2014-04-04 11:35:33 958

原创 LeetCode | Remove Duplicates from Sorted Array II

题目Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is now

2014-04-04 10:49:45 441

原创 LeetCode | Merge k Sorted Lists

题目Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.分析经典问题:k路归并,用一个大小为k小根堆保存每个链表的至多一个节点(链表空时,就没节点了),每次取出最小的节点,并插入该节点在链表中的下一个节点(如果不为空),直至取完所有链表

2014-04-04 10:32:56 605

原创 LeetCode | 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:"((()))", "(()())", "(())()", "()(())

2014-04-04 10:05:52 488

原创 LeetCode | Swap Nodes in Pairs

题目Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant

2014-04-03 15:17:51 421

原创 LeetCode | 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 pl

2014-04-03 15:16:00 423

原创 LeetCode | Remove Element

题目Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new leng

2014-04-03 15:14:10 416

原创 LeetCode | Implement strStr()

题目Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.分析KMP算法代码public class ImplementStrStr { public String

2014-04-03 15:11:58 425

原创 LeetCode | Next Permutation

题目Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest

2014-04-03 15:09:28 468

原创 LeetCode | Search in Rotated Sorted Array II

题目Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target i

2014-04-02 19:32:18 506

原创 LeetCode | Search in Rotated Sorted Array

题目Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the arr

2014-04-02 19:12:09 548

原创 LeetCode | Longest Valid Parentheses

题目Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is 

2014-04-02 19:06:28 934

原创 LeetCode | Search for a Range

题目Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is no

2014-04-01 19:07:49 489

原创 LeetCode | Search Insert Position

题目Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in th

2014-04-01 19:05:30 468

原创 LeetCode | Combination Sum II

题目Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the

2014-03-31 19:36:47 460

原创 LeetCode | Combination Sum

题目Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimi

2014-03-31 19:34:38 589

原创 LeetCode | Wildcard Matching

题目Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should

2014-03-31 19:31:27 4062 1

中兴捧月-数字化婚姻尝试配对

“中兴捧月”杯校园赛事嘉年华 程序设计大赛(初赛) 数字化婚姻尝试配对

2013-07-08

jmxremote-1_0_1-ri-bin-b58.zip

jmxremote-1_0_1-ri-bin-b58.zip 既然来下,就知道这是干啥的。。。。

2010-03-09

java编写的远程监控系统

用java编写的远程监控程序,结构简洁,适合参考学习。

2009-07-15

空空如也

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

TA关注的人

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