- 博客(20)
- 资源 (5)
- 收藏
- 关注
原创 LeetCode-49 Anagrams(返回字符相同的字符串)
LeetCode-49 Anagrams(返回字符相同的字符串)Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case. 一开始理解错题意。WA了好多次。。题目是指 返回字符串数组内 所有组成字符均相同的字符串
2015-04-29 18:07:40 810
原创 LeetCode-46 Permutations(全排列)
LeetCode-46 Permutations(全排列)Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2],
2015-04-29 18:04:40 761
原创 LeetCode-28 Implement strStr() (找出字串位置)
LeetCode-28 Implement strStr() (找出字串位置)Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Update (2014-11-02):The signa
2015-04-29 17:49:19 500
原创 LeetCode-27 Remove Element(水题-去掉元素)
LeetCode-27 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 yo
2015-04-29 17:34:59 573
原创 LeetCode-26 Remove Duplicates from Sorted Array(水题-去相同元素)
LeetCode-26 Remove Duplicates from Sorted ArrayGiven 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 fo
2015-04-29 17:29:39 1155
原创 LeetCode-24 Swap Nodes in Pairs(链表中按要求交换节点)
LeetCode-24 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
2015-04-29 17:12:57 491
原创 LeetCode-22 Generate Parentheses(合法括号情况)
LeetCode-22 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-04-29 17:01:18 611
原创 LeetCode-21 Merge Two Sorted Lists(合并两个有序链表)
LeetCode-21 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-04-25 12:58:19 889
原创 LeetCode-20 Valid Parentheses(判断括号是否规范)
LeetCode-20 Valid ParenthesesGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "
2015-04-25 11:55:04 810
原创 LeetCode-19 Remove Nth Node From End of List(移除尾部第N个节点)
LeetCode-19 Remove Nth Node From End of ListGiven 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. Af
2015-04-25 11:45:15 495
原创 LeetCode-17 Letter Combinations of a Phone Number(手机拨码-DFS)
LeetCode-17 Letter Combinations of a Phone Number(手机拨码-DFS)Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just l
2015-04-22 15:49:22 501
原创 LeetCode-15 3Sum(求3数和为零的情况总数)
Given 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 triplet (a,b,c)
2015-04-22 15:37:26 489
原创 LeetCode-11 Container With Most Water(容器装水最大量)
LeetCode-11 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 e
2015-04-22 15:17:01 632
原创 LeetCode-9 Palindrome Number(判断是否为回文int型)
LeetCode-9 Palindrome Number Determine whether an integer is a palindrome. Do this without extra space. 方法一:直接转String倒置public class Solution { public boolean isPalindrome(int x) {
2015-04-18 09:28:24 1111
原创 LeetCode-7 Reverse Integer(倒置整型数)
LeetCode-7 Reverse IntegerReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good que
2015-04-17 22:54:07 622
原创 LeetCode-6 ZigZag Conversion(字符串锯齿形输出)
LeetCode-6 ZigZag ConversionThe 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 legibil
2015-04-17 01:41:56 721
原创 LeetCode-5 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 palindromic substring.JAVA:public class So
2015-04-16 23:32:56 448
原创 LeetCode-3 Longest Substring Without Repeating Characters(最长无重复子串)
LeetCode-3-Longest Substring Without Repeating CharactersJAVA:import java.util.Arrays;public class Solution { public static int lengthOfLongestSubstring(String s) { int[] zimu = new int[1
2015-04-16 12:17:32 449
原创 LeetCode-2 Add Two Numbers
LeetCode-1 Add Two Numbers JAVA:/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; *
2015-04-16 08:48:56 484
转载 leetcode难度及面试频率
1Two Sum25arraysort setTwo Pointers 2Add Two Numbers34linked listT
2015-04-15 01:27:00 686
Android贪吃蛇程序代码分享
2015-01-24
mars-android-gps定位源码(3个)
2014-08-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人