自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 java基础(1)--反射

什么是反射……通常程序都是访问写的各个对象、使用对象的方法;反射使得程序可以访问对象的类型、类的方法、类的成员等信息,可以通过反射调用对象的方法反射有什么作用反编译:.classà.java通过反射机制,可访问java对象类型、方法、成员变量、构造方法反射如何使用1.获取Class(类类型)的实例对象:1) Class.forName(“类名的全称”) 加异常处理

2017-10-10 21:04:26 274

原创 Leetcode OJ 131 Palindrome Partitioning [Medium]

Leetcode OJ 131 Palindrome Partitioning [Medium]题目描述:Given a string s, partition s such thatevery substring of the partition is a palindrome.Return all possible palindrome partitioning of s.

2017-09-25 14:49:01 267

原创 Leetcode OJ 129 Sum Root to Leaf Numbers [Medium]

Leetcode OJ 129 Sum Root to Leaf Numbers [Medium]题目描述:Given a binary tree containing digits from 0-9 only, eachroot-to-leaf path could represent a number.An example is the root-to-leaf path 1->2

2017-09-22 10:55:53 216

原创 Leetcode OJ 102 Binary Tree Level Order Traversal [Medium]

Leetcode OJ 102 Binary Tree Level Order Traversal [Medium]《剑指offer》第4章-面试题32题目描述:Given a binary tree, return the level ordertraversal of its nodes' values. (ie, from left to right, level by leve

2017-09-21 17:30:54 238

原创 Leetcode OJ 91 Decode Ways [Medium]

Leetcode OJ 79 Word Search [Medium]《剑指offer》第5章(3)题目描述:A message containing letters from A-Z is being encoded tonumbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given

2017-09-20 11:39:08 337

原创 Leetcode OJ 79 Word Search [Medium]

Leetcode OJ 79 Word Search [Medium]题目描述:Given a 2D board and a word, find if the word exists inthe grid. The word can be constructed from letters of sequentiallyadjacent cell, where "adjacent" c

2017-09-19 10:47:03 345

原创 Leetcode OJ 77 Combinations [Medium]

Leetcode OJ 77 Combinations [Medium]题目描述:Given two integers nand k, return all possible combinations ofk numbers out of 1 ...n. For example,If n = 4 and k = 2,a solution is: [  [2,4], 

2017-09-18 16:18:11 497

原创 Leetcode OJ 78 Subsets [medium]

Leetcode OJ 78 Subsets [medium]题目描述:Given a set of distinctintegers, nums, return all possible subsets.Note: The solution setmust not contain duplicate subsets.For example,If nums = [1

2017-09-13 15:38:50 262

原创 Java List 总结

List接口继承于Collection接口,其实现类通常有ArrayList和LinkedList常用的自身的方法:add(int index,Object o)add(Object o)addAll(int index,Collection c)addAll(Collection c)remove(Object o)remove(int index)removeA

2017-09-13 15:34:49 208

原创 Leetcode OJ 69 Sqrt(x) [Easy]

Leetcode OJ 69 Sqrt(x) [Easy]题目描述:    Implement int sqrt(int x).    Compute and return the square root of x.题目理解:    完成函数sqrt(x),求x的平方根。测试用例:    功能测试:正整数;    边界测试:0;分析:    1.  二分法

2017-09-11 11:22:48 263

原创 Leetcode OJ 67 Add Binary [Easy]

Leetcode OJ 67 Add Binary [Easy]题目描述:Given two binary strings, returntheir sum (also a binary string). For example,a = "11"b = "1"Return "100".题目理解:给定另个字符串,字符串是二进制数,返回这两个二进制数的和,返回形式也

2017-09-10 21:54:24 296

原创 Leetcode OJ 49. Group Anagrams [Medium]

Leetcode OJ 49. Group Anagrams [Medium]题目描述:Given an array of strings, group anagrams together.For example, given: ["eat", "tea","tan", "ate", "nat", "bat"],Return: [ ["ate", "eat","tea"

2017-09-08 16:09:09 208

原创 Leetcode OJ 46. Permutations [Medium]

Leetcode OJ 46. Permutations [Medium]题目描述:    Given acollection of distinct numbers, return all possible permutations.     For example,    [1,2,3] have the following permutations:    [  [1,2

2017-09-07 22:04:40 211

原创 Leetcode OJ 24 Swap Nodes in Pairs [Medium]

Leetcode OJ 27 Swap Nodes in Pairs [Medium]题目描述:Given alinked 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.

2017-09-06 14:13:18 181

原创 Leetcode OJ 27 Remove Element [Easy]

Leetcode OJ 27 Remove Element [Easy]题目描述:Given anarray and a value, remove all instances of that value in place and return thenew length.Do notallocate extra space for another array, you must

2017-09-05 21:20:07 175

原创 Leetcode OJ 23 Merge k Sorted Lists [Hard]

Leetcode OJ 23 Merge k Sorted Lists [Hard] 题目描述:    Merge k sorted linked lists and return it as one sortedlist. Analyze and describe its complexity. 题目理解:    将k个排序链表合并为一个排序链表。测试用例:

2017-08-31 21:34:51 210

原创 Leetcode OJ 22 Generate Parentheses [Medium]

Leetcode OJ 22 Generate Parentheses [Medium]题目描述:Given n pairs of parentheses, write a function togenerate all combinations of well-formed parentheses.For example, given n = 3, a solution set

2017-08-30 20:45:21 238

原创 《剑指offer》笔记-第6章(1)

第6章面试中的各项能力6.1面试官谈能力       沟通能力:礼貌平和、不卑不亢、逻辑清晰、详略得当地表达;发现问题并主动发问;学习能力: 对做过的项目了解深入;对面试题快速寻找解决方法;        考查沟通能力:介绍过往项目;讲解设计思路和代码;考查学习能力: 提问没有接触过的问题;看书;关注什么;得到暗示后迅速做出反应并纠正; 6.2沟通能力和学习能力

2017-08-28 21:52:32 244

原创 《剑指offer》笔记-第5章(5)

面试题50:第一个只出现一次的字符题目一:实现函数,找出字符串中第一个只出现一次的字符,如“abaccdeff”,输出b测试用例:     功能测试:字符串所有字符都出现多次;字符串中所有字符都出现一次;字符串中存在只出现一次的字符;     特殊输入:字符串为null;分析:     1.    从头扫描字符,拿到一个字符后,与其后面的字符比较,如果没有重复的字符,则它是

2017-08-24 21:00:42 162

原创 《剑指offer》笔记-第5章(4)

面试题47:礼物的最大价值在一个m*n的期盼的每一格都放有一个礼物,每个礼物具有一定价值(大于0)。从期盼的左上角开始拿礼物,并每次向右或者向下移动一个,直到达到棋盘的右下角。实现一个函数,给定一个棋盘和上面的礼物,计算能最多拿走多大价值的礼物。       测试用例:              功能测试:多行多列矩阵;一行矩阵;一列矩阵;只有一个数字的矩阵;特殊输入:矩阵为nul

2017-08-23 21:37:51 459

原创 《剑指offer》笔记-第5章(3)

面试题45:把数组排成最小的数     输入一个正整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接出的所有数字中最小的一个。如输入数组{3,32,321},打印出321323。测试用例:     功能测试:数组中有多个数字;数组中有重复数字;数组中只有一个数字;     特殊输入:数组是null;分析:     1.    求出所有数字的全排列(n个数字共有n!个排

2017-08-21 21:22:51 204

原创 《剑指offer》笔记-第5章(2)

面试题42:连续子数组的最大和      输入一个整型数组,数组里有正数也有负数。数组中一个或连续多个整数组成一个子数组。求所有子数组的和的最大值。要求时间复杂度是O(n)。例如,数组为{1,-2,3,10,-4,7,2,-5},和最大的子数组为{3,10,-4,7,2},输出位18。测试用例:      功能测试:数组中有正数也有负数;数组中只有正数;数组中只有负数;

2017-08-20 21:55:58 250

原创 《剑指offer》笔记-第5章(1)

第五章

2017-08-18 22:50:52 223

原创 Leetcode OJ 22 Generate Parentheses [Medium]

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

2017-08-16 22:04:27 254

原创 Leetcode OJ 12 Integer to Roman [Medium]

Leetcode OJ 12 Integer to Roman [Medium]题目描述:Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to3999题目理解:给定一个整数,将其转换成一个罗马数字,输入的范围是1到3999。罗

2017-08-15 14:37:18 211

原创 LeetCode OJ 543 Diameter of Binary Tree [Easy]

题目描述:Given a binary tree,you need to compute the length of the diameter of the tree. The diameter of abinary tree is the length of the longest path between any two nodes in a tree.This path may or m

2017-08-02 21:50:45 231

原创 Leetcode OJ 2 Add Two Numbers [Medium]

Leetcode OJ 2 Add Two Numbers题目描述:You are given two non-empty linked lists representingtwo non-negative integers. The digits are stored in reverse order and each oftheir nodes contain a single dig

2017-07-31 15:39:53 263

原创 Leetcode OJ 127 Word Ladder [Medium]

Leetcode OJ 127 Word Ladder  题目描述:Given two words (beginWord and endWord), and adictionary's word list, find the length of shortest transformation sequencefrom beginWord to endWord, such that:

2017-07-28 22:01:41 431

转载 java 遍历arrayList的四种方法

http://blog.csdn.net/u013956878/article/details/56670753

2017-07-27 10:19:24 629

原创 Leetcode OJ 125 Valid Palindrome [Easy]

Leetcode OJ 125 Valid Palindrome 题目描述:Given a string, determine if it is a palindrome,considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama"

2017-07-26 21:52:58 263

原创 《剑指offer》笔记-第4章(4)

面试题36:二叉搜索树与双向链表       输入一棵二叉搜索树,将二叉搜索树转换成一个排序的双向链表,要求不能创建任何新的节点,只能调整树中的节点指针指向。测试用例:         功能测试:完全二叉树、只有左/右子树、只有一个节点的二叉树         特殊输入:二叉树根节点是null分析:       1.    二叉树中每个节点有两个指针分别指向左子节点和右子节

2017-07-25 20:19:33 213

原创 《剑指offer》笔记-第4章(3)

面试题33:二叉搜索树的后序遍历序列       输入一个整数数组,判断该数组是不是某二叉树搜索树的后序遍历结果。假设输入数组的任意两个数字不相等。{7,4,6,5}返回false,该序列没有二叉树与之对应;测试用例:       功能测试:输入的后序遍历所对应的二叉树是:完全二叉树、所有节点只有左/右子树的二叉树;输入序列应返回false;       特殊输入:序列是null;

2017-07-25 20:15:20 171

原创 Leetcode OJ 70 Climbing Stairs [Easy]

Leetcode OJ 70. Climbing Stairs 题目描述:You are climbing astair case. It takes n steps to reach to the top.Each time you caneither climb 1 or 2 steps. In how many distinct ways can you climb to the

2017-07-24 21:50:15 215

原创 《剑指offer》笔记-第4章(2)

3.3举例让抽象问题具体化分析复杂问题时可以用举例的方法来模拟;具体的例子能够更清楚地向面试官解释算法,算法本身很抽象,用例子解释会更清楚;测试用例就是例子,可以帮助我们确保代码的质量;面试题30:包含min函数的栈定义栈的数据结构,在该类型中实现一个能够得到栈的最小元素的函数min(),调用min()、push、pop的时间复杂度都是O(1);       测试用例:

2017-07-21 21:54:56 210

原创 Leetcode OJ 98 Validate Binary Search Tree [Medium]

Leetcode OJ 98 Validate Binary Search Tree题目描述:Given a binary tree, determine if it is a valid binarysearch tree (BST). Assume a BST is defined as follows: The left subtree of a node contains

2017-07-20 21:55:14 297

原创 Leetcode OJ 88 Merge Sorted Array [Easy]

Leetcode OJ 88 Merge Sorted Array题目描述:Given two sorted integer arrays nums1 and nums2, merge nums2into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that isgr

2017-07-20 20:50:27 201

原创 《算法》-3.3平衡查找树(2)

3.3.2 红黑二叉查找树

2017-07-19 21:57:11 369

原创 《算法》-3.3平衡查找树(1)

3.3 平衡查找树3.3.1  2-3查找树

2017-07-18 21:00:32 308

原创 Leetcode OJ 73 Set Matrix Zeroes [Medium]

题目描述:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.解答:public class Solution {public void setZeroes(int[][] matrix) { boolean fr = false,fc = f

2017-07-17 23:13:28 265

原创 《剑指offer》笔记-第4章(1)

第4章 解决面试题的思路4.1面试官谈面试思路       编码前讲自己的思路       具体地将问题分析过程、证明       举例子、画图的方式讲清楚问题本身和解决问题的关键       分析的过程中发现错误和漏洞并改正4.2画图让抽象问题形象化面试题27:二叉树的镜像实现函数,输入一棵二叉树,输出它的镜像(照镜子,左节点变成右节点),节点定义如下:str

2017-07-14 22:01:13 165

空空如也

空空如也

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

TA关注的人

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