- 博客(22)
- 资源 (4)
- 收藏
- 关注
原创 【LeetCode】29. Divide Two Integers - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividing dividen...
2018-11-28 22:58:40 1016
原创 【LeetCode】28. Implement strStr() - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = “hell...
2018-11-26 23:15:45 477
原创 【LeetCode】27. Remove Element - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you m...
2018-11-24 15:02:08 272
原创 【LeetCode】26. Remove Duplicates from Sorted Array - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for ano...
2018-11-24 12:34:27 495
原创 【LeetCode】25. Reverse Nodes in k-Group - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the lengt...
2018-11-24 10:23:36 674
原创 【LeetCode】24. Swap Nodes in Pairs - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given a linked list, swap every two adjacent nodes and return its head.Example:Given 1->2->3->4, you should return the list as 2->1->4->3....
2018-11-24 10:15:45 576
原创 【LeetCode】23. Merge k Sorted Lists - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[ 1->4->5, 1->3->4, 2->6]...
2018-11-23 22:20:55 464
原创 【LeetCode】22. Generate Parentheses - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述: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:[ “((()))...
2018-11-23 08:24:25 394
原创 【LeetCode】21. Merge Two Sorted Lists - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述: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.Example:Input: 1...
2018-11-22 07:50:08 434
原创 【LeetCode】20. Valid Parentheses - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open bracke...
2018-11-22 07:44:02 787
原创 【LeetCode】19. Remove Nth Node From End of List - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After rem...
2018-11-21 08:22:05 357
原创 【LeetCode】18. 4Sum - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets...
2018-11-20 08:07:05 510
原创 【LeetCode】17. Letter Combinations of a Phone Number - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (jus...
2018-11-20 07:24:35 372
原创 【LeetCode】16. 3Sum Closest - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integer...
2018-11-18 15:14:32 355
原创 【LeetCode】15. 3Sum - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero...
2018-11-18 12:51:19 380
原创 【LeetCode】14. Longest Common Prefix - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string "".Example 1:Inpu...
2018-11-18 11:40:39 423
原创 【LeetCode】13. Roman to Integer - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D...
2018-11-18 11:27:02 768
原创 【LeetCode】12. Integer to Roman - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D...
2018-11-18 11:07:16 273
原创 【LeetCode】11. Container With Most Water - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given n non-negative integers a[1], a[2], …, a[n] , where each represents a point at coordinate (i, a[i]). n vertical lines are drawn such that the two endpoint...
2018-11-15 08:23:41 206
原创 【LeetCode】10. Regular Expression Matching - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.‘.’ Matches any single character.‘*’ Matches ...
2018-11-14 08:30:31 310
原创 【LeetCode】9. Palindrome Number - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExampl...
2018-11-12 23:23:17 419
原创 【LeetCode】8. String to Integer (atoi) - Java实现
文章目录1. 题目描述:2. 思路分析:3. Java代码:1. 题目描述:Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace char...
2018-11-11 18:08:50 391
C语言---经典编程900例---------------------
2010-05-07
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人