- 博客(347)
- 资源 (79)
- 收藏
- 关注
原创 leetcode:Move Zeroes 【Java】
一、问题描述Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after
2016-03-17 19:59:55 481
原创 leetcode:Contains Duplicate 【Java】
一、问题描述Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every
2016-03-16 16:42:07 391
原创 leetcode:Invert Binary Tree 【Java】
一、问题描述Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1二、问题分析无三、算法代码/** * Definition for a binary tree node.
2016-03-16 16:09:23 404
原创 leetcode:Combination Sum 【Java】
一、问题描述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 un
2016-03-16 15:32:51 377
原创 leetcode:Restore IP Addresses 【Java】
一、问题描述Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.3
2016-03-15 23:07:31 674
原创 leetcode:Valid Anagram 【Java】
一、问题描述Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:
2016-03-15 18:48:14 384
原创 leetcode:N-Queens II 【Java】
一、问题描述Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.二、问题分析参考问题leetcode:N-Queens 【Java】三、算法代码public clas
2016-03-15 16:16:41 361
原创 leetcode:N-Queens 【Java】
一、问题描述The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-q
2016-03-15 16:12:44 614
原创 回溯算法之N皇后问题
一、问题描述N皇后问题,就是把N个皇后放到NXN的棋盘上,使她们不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上。二、问题分析典型的回溯问题;queens[k]表示皇后k放在queens[k]位置上。三、算法代码算法参数int [] queens可以随意传值,它们的长度即代表queens.length皇后问题,可以解决任意NXN问题。/** *
2016-03-14 22:54:06 866
原创 10款流行的Markdown编辑器
10款流行的Markdown编辑器链接http://www.csdn.net/article/2014-05-05/28196231.MarkdownPad 2.ReText3.WMD4.Mou5.EpicEditor6.CuteMarkEd7.MarkPad8.Haroopad9.MarkdownEditor10.QMarkdowner
2016-03-14 10:48:01 1908
原创 leetcode:Integer to Roman 【Java】
一、问题描述Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.二、问题分析无三、算法代码public class Solution { public String intToRoman(int
2016-03-13 22:26:53 471
原创 leetcode:Longest Common Prefix 【Java】
一、问题描述Write a function to find the longest common prefix string amongst an array of strings.二、问题分析无三、算法代码public class Solution { public String longestCommonPrefix(String[] strs) {
2016-03-13 22:20:28 394
原创 leetcode:Climbing Stairs 【Java】
一、问题描述You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?二、问题分析此问题实际为斐波那契
2016-03-13 21:00:18 554
原创 leetcode:Rotate Image 【Java】
一、问题描述You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?二、问题分析先沿着副对角线翻转一次;再沿着水平对称轴翻转一次。
2016-03-13 20:16:05 452
原创 leetcode:Candy 【Java】
一、问题描述There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have
2016-03-13 19:17:07 611
原创 leetcode:Gas Station 【Java】
一、问题描述There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from s
2016-03-12 13:11:42 419
原创 leetcode:Partition List 【Java】
一、问题描述Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the node
2016-03-11 17:04:52 384
原创 leetcode:Group Anagrams 【Java】
一、问题描述Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]
2016-03-11 14:51:12 1984
原创 leetcode:Length of Last Word 【Java】
一、问题描述Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Not
2016-03-11 14:05:10 398
原创 leetcode:Reverse Linked List 【Java】
一、问题描述Reverse a singly linked list.二、问题分析利用三个指针pre、nxt、cur,最后返回指针pre。三、算法代码/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; *
2016-03-11 13:48:27 400
原创 leetcode:Palindrome Linked List 【Java】
一、问题描述Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?二、问题分析把后半部分链表翻转后,与前半部分比较。三、算法代码/** * Definition for singly-
2016-03-10 23:53:26 528
原创 leetcode:Valid Palindrome 【Java】
一、问题描述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" is a palindrome."race a ca
2016-03-10 23:22:47 339
原创 leetcode:Rotate List 【Java】
一、问题描述Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.二、问题分析使链表最后一个结点指向头结
2016-03-10 23:02:50 353
原创 leetcode:Remove Nth Node From End of List 【Java】
一、问题描述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
2016-03-10 21:22:33 299
原创 leetcode:Odd Even Linked List 【Java】
一、问题描述Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try
2016-03-10 20:55:24 568
原创 leetcode:Remove Linked List Elements 【Java】
一、问题描述Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5二、问题分析设置两个指针
2016-03-10 18:43:31 383
原创 leetcode:Delete Node in a Linked List 【Java】
一、问题描述Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third nod
2016-03-09 22:56:20 352
原创 leetcode:Remove Duplicates from Sorted List 【Java】
一、问题描述Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.二、问题分析无三、
2016-03-09 22:44:18 336
原创 leetcode:Add Binary 【Java】
一、问题描述Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".二、问题分析把两个字符串用‘0’补充为相同长度后,从高位到低位模拟二进制真实运算,最后把结果反转后返回。三、算法代码public
2016-03-09 22:27:23 286
原创 leetcode:Add Two Numbers 【Java】
一、问题描述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
2016-03-09 21:32:17 357
原创 leetcode:Median of Two Sorted Arrays 【Java】
一、问题描述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)).二、问题分析合并两
2016-03-08 21:41:08 330
原创 leetcode:Ugly Number II 【Java】
一、问题描述Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence o
2016-03-08 21:00:46 421
原创 leetcode:Ugly Number 【Java】
一、问题描述Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is n
2016-03-08 17:25:44 396
原创 leetcode:Symmetric Tree 【Java】
一、问题描述Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3
2016-03-08 14:16:45 375
原创 leetcode:Same Tree 【Java】
一、问题描述Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
2016-03-08 12:54:52 374
原创 leetcode:Recover Binary Search Tree 【Java】
一、问题描述wo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pretty straight forward. Coul
2016-03-08 12:39:58 314
原创 leetcode:Flatten Binary Tree to Linked List 【Java】
一、问题描述Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look lik
2016-03-08 11:18:12 343
原创 leetcode:Path Sum II 【Java】
一、问题描述Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5
2016-03-08 10:15:44 335
原创 leetcode:Populating Next Right Pointers in Each Node II 【Java】
一、问题描述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 u
2016-03-07 22:43:57 463
原创 leetcode:Populating Next Right Pointers in Each Node 【Java】
一、问题描述Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next
2016-03-07 21:56:18 275
mac hadoop2.6.0 lib/native
2016-07-02
chrome-plugins
2016-07-02
struts2.3.20和log4j1.2.9完整开发jar包
2016-04-04
web容量规划的艺术
2015-11-09
HowTomcatWorks.zip
2019-07-11
UDP_Specification-rfc768
2019-04-21
IPv4_Specification-rfc791
2019-04-21
numpy-1.9.2-win32-superpack-python2.7
2017-03-26
redis-desktop-manager-0.8.8.384
2017-01-05
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人