自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Yingying

你必须非常努力,才能看起来毫不费力

  • 博客(116)
  • 收藏
  • 关注

转载 java 中基本数据类型和封装类

java提供了一组基本数据类型,包括boolean, byte, char, short,  int, long, float, double, void. 同时,java也提供了这些类型的封装类,分别为Boolean, Byte, Character, Short, Integer, Long, Float, Double, Void什么Java会

2017-01-31 17:24:27 1163

转载 Integer和int

转载自:Referenceint 是基本类型,直接存数值 integer是对象,用一个引用指向这个对象 1.Java 中的数据类型分为基本数据类型和复杂数据类型 int 是前者>>integer 是后者(也就是一个类) 2.初始化时>> int i =1; Integer i= new Integer(1);(要把integer 当做一个类看) int

2017-01-31 17:12:31 193

转载 Java中的自动装箱拆箱

转载自:Reference什么是自动装箱拆箱基本数据类型的自动装箱(autoboxing)、拆箱(unboxing)是自J2SE 5.0开始提供的功能。 一般我们要创建一个类的对象实例的时候,我们会这样: Class a = new Class(parameter); 当我们创建一个Integer对象时,却可以这样: Integer i =

2017-01-31 17:09:48 205

原创 241. Different Ways to Add Parentheses**

Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.Example 1

2017-01-31 16:57:57 238

原创 240. Search a 2D Matrix II**

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right.Integers in

2017-01-31 14:27:46 244

原创 待总结

dynamic programminglinked listtwo pointersstringdivide and conquerbinary searchstackheap queuetreebfs/dfssort bit manipulation

2017-01-31 13:26:21 215

原创 464. Can I Win**

In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach or exceed 100 wins.What if we change the game s

2017-01-30 23:23:17 391

原创 486. Predict the Winner**

Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a

2017-01-30 20:44:05 680

原创 375. Guess Number Higher or Lower II**

We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I'll tell you whether the number I pi

2017-01-30 20:06:35 253

原创 398. Random Pick Index**

Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.Note:The array size c

2017-01-30 18:22:24 203

原创 130. Surrounded Regions**

Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,

2017-01-30 17:51:27 268

原创 200. Number of Islands**

Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assu

2017-01-30 17:10:30 217

原创 394. Decode String**

Given an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where the encoded_stringinside the square brackets is being repeated exactly k times. Note thatk is g

2017-01-30 16:54:41 246

原创 117. Populating Next Right Pointers in Each Node II**

Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant

2017-01-30 12:21:02 253

原创 133. Clone Graph**

Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for each

2017-01-29 23:27:59 257

原创 98. Validate Binary Search Tree**

Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.Th

2017-01-29 22:50:58 247

原创 hashmap

http://docs.oracle.com/javase/8/docs/api/java/util/HashMap.htmlThe HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls. If multiple threads a

2017-01-29 20:26:49 129

原创 210. Course Schedule II**

There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as

2017-01-29 16:16:51 240

原创 207. Course Schedule**

There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as

2017-01-29 15:27:02 298

原创 473. Matchsticks to Square**

Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has, please find out a way you can make one square by using up all those matchsticks. You shoul

2017-01-27 19:57:12 226

原创 332. Reconstruct Itinerary**

Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs from JFK. Thus,

2017-01-25 23:36:43 351

原创 106. Construct Binary Tree from Inorder and Postorder Traversal**

Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.Recursive:public class Solution { public TreeNod

2017-01-25 23:06:53 254

原创 491. Increasing Subsequences**

Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increasing subsequence should be at least 2 .Example:In

2017-01-23 18:23:53 770

原创 334. Increasing Triplet Subsequence**

Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the function should:Return true if there exists i, j, k such that arr[i] ar

2017-01-23 13:14:51 202

原创 424. Longest Repeating Character Replacement**

Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times. Find the length of a longest substring containing all repe

2017-01-19 22:45:57 213

原创 108. Convert Sorted Array to Binary Search Tree**

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.My code:public class Solution { public TreeNode sortedArrayToBST(int[] nums) { if(nums.

2017-01-19 22:19:41 187

原创 452. Minimum Number of Arrows to Burst Balloons**

There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it's horizontal, y-coordin

2017-01-19 21:52:54 207

原创 319. Bulb Switcher**

There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or turning off

2017-01-19 21:32:30 180

原创 318. Maximum Product of Word Lengths**

Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case le

2017-01-19 21:09:18 294

原创 423. Reconstruct Original Digits from English**

Given a non-empty string containing an out-of-order English representation of digits0-9, output the digits in ascending order.Note:Input contains only lowercase English letters.Input is guar

2017-01-19 11:21:36 235

原创 482. License Key Formatting**

Now you are given a string S, which represents a software license key which we would like to format. The string S is composed of alphanumerical characters and dashes. The dashes split the alphanumeric

2017-01-19 11:03:28 322

原创 462. Minimum Moves to Equal Array Elements II**

Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected element by

2017-01-19 10:38:30 224

原创 481. Magical String**

A magical string S consists of only '1' and '2' and obeys the following rules:The string S is magical because concatenating the number of contiguous occurrences of characters '1' and '2' generates

2017-01-19 00:04:40 522

原创 442. Find All Duplicates in an Array**

Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that appear twice in this array.Could you do it without ex

2017-01-18 23:44:04 168

原创 382. Linked List Random Node**

Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen.Follow up:What if the linked list is extremely large and i

2017-01-16 23:46:28 226

原创 477. Total Hamming Distance**

The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Now your job is to find the total Hamming distance between all pairs of the giv

2017-01-16 23:34:32 257

原创 384. Shuffle an Array**

Shuffle a set of numbers without duplicates.// Init an array with set 1, 2, and 3.int[] nums = {1,2,3};Solution solution = new Solution(nums);// Shuffle the array [1,2,3] and return its result

2017-01-16 22:26:04 178

原创 396. Rotate Function*

Given an array of integers A and let n to be its length.Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a "rotation function" F onA as follow:

2017-01-16 22:12:27 211

原创 437. Path Sum III*

You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to start or end at the root or a leaf, but it

2017-01-16 21:38:36 217

原创 438. Find All Anagrams in a String*

Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.Strings consists of lowercase English letters only and the length of both strings s and p will not be lar

2017-01-16 10:23:01 231

空空如也

空空如也

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

TA关注的人

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