自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 LeetCode_Group Anagrams

Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note:

2015-11-09 19:04:25 387

转载 java-数据类型总结

原文地址:http://www.cnblogs.com/doit8791/archive/2012/05/25/2517448.html1. Java的简单类型及其封装器类Java基本类型共有八种,基本类型可以分为三类,字符类型char,布尔类型boolean以及数值类型byte、short、int、long、float、double。数值类型又可以分为整数类型byte、short

2015-11-03 11:17:46 358

原创 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 array retur

2015-09-16 11:07:08 361

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

2015-09-15 11:01:40 308

原创 LeetCode_Submission Details

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 possible o

2015-09-14 11:28:33 367

原创 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 length.分

2015-09-06 10:20:47 263

原创 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 place with

2015-09-03 13:33:13 280

原创 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 as it is

2015-09-02 14:27:42 300

原创 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 space. Y

2015-09-01 16:17:30 389

原创 InfluxDB_0.9 之我见(一)

关于InfluxDB数据库,网上大多数是0.7/0.8的版本的介绍,对于当下的版本0.9,还有不少变更的地方,下面简单地说一下这几天学习InfluxDB的心得体会。InfuxDB的具体是怎样的一个数据库不过多介绍,按官网说:“InfluxDB is a time series, metrics, and analytics database. It’swritten in Go and h

2015-09-01 14:03:31 7421

原创 LeetCode_Merge k Sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Divide and Conquer Linked List Heap分析:题目要求将若干个已排好序的ListNode合并成一个有序的ListNode,可以看做“

2015-08-31 16:02:19 328

原创 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-08-28 16:47:54 540

原创 Merge Two Sorted Lists

题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.分析:题目要求合并两个已排序的链表,这里指的是两个从小到大排好序的,合并完成的链表也是有序的,从

2015-08-27 18:40:55 319

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

2015-08-27 17:20:47 271

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

2015-08-26 17:07:12 343

原创 LeetCode_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 buttons) is given below.Input:Digit st

2015-05-24 10:19:21 358

原创 LeetCode_3Sum

3SumGiven 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 trip

2015-05-18 16:03:43 316

转载 java——堆、栈、常量池、equal、==、hashcode

参考:http://blog.csdn.net/andy_miao858/article/details/8302309JAVA和C语言一个很大的不同就是:在C语言中我们可以通过“&”很容易的获取一个对象的地址,而在JAVA中,我们却似乎找不到什么方法可以获取到对象的地址(有人可能以为hashcode就代表地址,其实不然,两个不同的对象hashcode完全可能一样),但绝不代表JA

2015-05-04 10:00:41 446 1

转载 java垃圾回收机制 详细分析

参考 http://blog.csdn.net/zsuguangh/article/details/64295921. 垃圾回收的意义  在C++中,对象所占的内存在程序结束运行之前一直被占用,在明确释放之前不能分配给其它对象;而在Java中,当没有对象引用指向原先分配给某个对象的内存时,该内存便成为垃圾。JVM的一个系统级线程会自动释放该内存块。垃圾回收意味着程序不再需要的对象是

2015-05-03 20:22:56 405

原创 LeetCode_Longest Common Prefix

Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings.题目要求找出一个字符串数组中所有字符串的最长公共前缀字符串,比如{"abcde","abcdefg","abqq"},最长公共前缀字符串为“ab”。需要注意

2015-05-02 21:00:30 296

原创 LeetCode_Roman to Integer

Roman to Integer Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.题目要求输入罗马数字(字符串),输出相应的整形数字,范围从1~3999.从百度百科摘抄了以下罗马数字的规则:

2015-05-02 20:28:31 291

原创 LeetCode_Container With Most Water

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 li

2015-05-02 16:57:43 419

原创 LeetCode_Regular Expression Matching

Regular Expression Matching Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The mat

2015-05-01 19:36:42 381

原创 LeetCode_Palindrome Number

Palindrome Number Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting

2015-04-30 19:44:21 271

转载 synchronized与static synchronized

synchronized与static synchronized 的区别      synchronized是对类的当前实例进行加锁,防止其他线程同时访问该类的该实例的所有synchronized块,注意这里是“类的当前实例”, 类的两个不同实例就没有这种约束了。那么static synchronized恰好就是要控制类的所有实例的访问了,static synchronized是限制线

2015-04-30 18:48:54 355

原创 LeetCode_String to Integer (atoi)

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 yourse

2015-04-29 21:38:13 551

原创 LeetCode_Reverse Integer

Reverse Integer Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Have you thought about this?Here are some good questions to ask before codi

2015-04-29 09:59:42 464

原创 LeetCode_ZigZag Conversion

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 legibilit

2015-04-29 09:13:42 306

原创 LeetCode_Longest Palindromic Substring

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 palind

2015-04-27 19:53:17 268

原创 LeetCode_Median of Two Sorted Arrays

题目:There are two sorted arrays nums1 and nums2 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-04-27 12:46:29 312

原创 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. Fo

2015-04-26 17:27:07 300

原创 Leetcode_Add Two Numbers

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 numbe

2015-04-26 13:51:00 421

原创 LeetCode_Two Sum

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

2015-04-26 09:55:13 408

原创 给出一个数和一个有序数组,找出该数组中之和等于该数的两个数

今天写的一个版本:1、有序数组,先写一个二分查找的方法private static int[] erfen(int[] a,int left,int right,int num) { //left:数组a的左边界 //right:数组a的右边界 //num:目标数 //返回int[0]是是否找到了该数,1为找到了,0为未找到;int[1]是如果找到了则返回改数的序号,如果未

2015-04-26 09:29:41 1224

原创 快速排序的一种java实现

首先上一张图:然后写出如下java代码,请多多指正:public class quickSort { public static void main(String[] args) { int[] a = new int[]{6,3,9,14,12,7,2}; mysort(a,0,a.length-1); for(int i =0;i<a.length;i++)

2015-04-25 17:12:35 324

原创 二叉树的各种遍历(先序、中序、后续、层次)——递归、非递归

package btree;import java.util.Queue;import java.util.Stack;import java.util.concurrent.LinkedBlockingQueue;public class Btree { /** * 结点类。 * @author Bao Yiming */ cla

2015-04-25 10:45:10 464

转载 编程面试过程中常见的10大算法

以下是在编程面试中排名前10的算法相关的概念,我会通过一些简单的例子来阐述这些概念。由于完全掌握这些概念需要更多的努力,因此这份列表只是作为一个介绍。本文将从Java的角度看问题,包含下面的这些概念:1. 字符串如果IDE没有代码自动补全功能,所以你应该记住下面的这些方法。toCharArray() // 获得字符串对应的char数组Arrays.sort()  // 数组排序

2015-04-25 10:40:47 404

转载 各种排序算法的分析及java实现

排序大的分类可以分为两种:内排序和外排序。在排序过程中,全部记录存放在内存,则称为内排序,如果排序过程中需要使用外存,则称为外排序。下面讲的排序都是属于内排序。  内排序有可以分为以下几类:(1)、插入排序:直接插入排序、二分法插入排序、希尔排序。(2)、选择排序:简单选择排序、堆排序。(3)、交换排序:冒泡排序、快速排序。(4)、归并排序(5)、基数排序 一、插入

2015-04-25 10:39:25 480

转载 各类查找算法及Java实现

一 线性查找 又称顺序查找,是从数组的第一个元素开始查找,直到找到待查找元素的位置,直到查找到结果。 最佳的状况时间是1 ,就是第一个就是待查找的远射,最差的查找状况是O(n),就是最后一个是待查找的元素。 二 折半查找 折半查找是将待查找的数组元素不断的分为两部分,每次淘汰二分之一,但是有个大前提是,元素必须是有序的,如果是无序的则要先进行排序操作,这种查找的方法,类似于找英

2015-04-25 10:31:35 424

转载 string、StringBuffer、StringBuilder解析

String的值是不可变的,这就导致每次对String的操作都会生成新的String对象,不仅效率低下,而且大量浪费有限的内存空间,StringBuffer是可变类,和线程安全的字符串操作类,任何对它指向的字符串的操作都不会产生新的对象,StringBuffer和StringBuilder类功能基本相似1. String 类 String的值是不可变的,这就导致每次对String的操作

2015-04-25 10:27:19 268

空空如也

空空如也

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

TA关注的人

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