自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 【Leetcode Algorithm】Summary Ranges

Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].public class Solution { public List summaryRa

2015-07-29 21:12:12 298

原创 【Leetcode Algorithm】Power of Two

Given an integer, write a function to determine if it is a power of two.第一次尝试代码:public class Solution { public boolean isPowerOfTwo(int n) { //如果为0,则false if(n==0){

2015-07-06 21:45:38 263

原创 【Leetcode Algorithm】Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get

2015-07-03 21:24:16 201

原创 【Leetcode Algorithm】Count and Say

The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as 

2015-07-03 11:14:02 291

原创 【Leetcode Algorithm】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 partially

2015-07-03 10:20:14 550

原创 【Leetcode Algorithm】Implement strStr()

Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.自己的代码:public class Solution { public int strStr(String hayst

2015-07-02 21:23:48 230

原创 【Leetcode Algorithm】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-07-02 21:22:45 228

原创 【Leetcode Algorithm】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-07-02 17:03:36 214

原创 【Leetcode Algorithm】Invert Binary Tree

Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired by this original tweet by Max Howe

2015-07-02 15:20:53 286

原创 【Leetcode Algorithm】Rectangle Area

Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.Assume that the tota

2015-07-02 15:19:43 194

原创 【Leetcode Algorithm】Contains Duplicate II

Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between iand j is at most

2015-07-02 15:17:55 294

原创 【Leetcode Algorithm】Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.代码:1234567891011121314151617181920

2015-07-02 15:17:14 590

原创 【Leetcode Algorithm】Happy Number

Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares

2015-07-02 15:15:07 279

原创 【Leetcode Algorithm】Add Binary

Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".自己的代码123456789101112

2015-07-02 15:12:50 214

原创 【Leetcode Algorithm】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-07-02 15:10:42 238

原创 【Leetcode Algorithm】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-07-02 15:10:09 271

原创 【Leetcode Algorithm】Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.自己的代码:12345678910111213141516

2015-07-02 15:09:19 355

原创 【Leetcode Algorithm】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 va

2015-07-02 15:08:25 244

原创 【Leetcode Algorithm】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.自己尝试的代码:1234567

2015-07-02 15:07:26 261

空空如也

空空如也

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

TA关注的人

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