LeetCode
文章平均质量分 68
hechenghai
已经不走技术路线了,可能没法回到大家的问题了,抱歉!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[LeetCode]Largest Rectangle in Histogram
Largest Rectangle in HistogramMy SubmissionsQuestionTotal Accepted: 49964 Total Submissions: 215334 Difficulty: HardGiven n non-negative integers representing the histogram原创 2015-12-06 11:27:35 · 554 阅读 · 0 评论 -
[LeetCode] Integer to Roman
Integer to RomanMy SubmissionsQuestion Solution Total Accepted: 44525 Total Submissions: 127649 Difficulty: MediumGiven an integer, convert it to a roman numeral.Input is g原创 2015-10-10 10:16:09 · 428 阅读 · 0 评论 -
LeetCode Container With Most Water
Container With Most WaterTotal Accepted: 52276 Total Submissions: 163550 Difficulty: MediumGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinat原创 2015-09-20 22:58:21 · 385 阅读 · 0 评论 -
[LeetCode] Roman to Integer
Roman to IntegerMy SubmissionsQuestion Solution Total Accepted: 56002 Total Submissions: 159037 Difficulty: EasyGiven a roman numeral, convert it to an integer.Input is gua原创 2015-10-10 10:41:16 · 371 阅读 · 0 评论 -
[LeetCode]4Sum
4SumMy SubmissionsQuestion Solution Total Accepted: 50999 Total Submissions: 230927 Difficulty: MediumGiven an array S of n integers, are there elements a, b, c, and d in S s转载 2015-10-20 19:20:57 · 500 阅读 · 0 评论 -
[LeetCode] Search Insert Position
Search Insert PositionMy SubmissionsQuestionTotal Accepted: 79962 Total Submissions: 222866 Difficulty: MediumGiven a sorted array and a target value, return the index if the t原创 2015-11-05 23:05:19 · 395 阅读 · 0 评论 -
LeetCode Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.public class Solution { public boolean isPalindrome(int x) { if(x<0)return false; int a = 1; int b = x;原创 2015-07-16 09:06:33 · 406 阅读 · 0 评论 -
Reverse Integer
Reverse 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 questions to ask before c转载 2015-07-07 23:51:43 · 480 阅读 · 0 评论 -
LeetCode – Regular Expression Matching in Java
Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire inp转载 2015-07-26 00:46:43 · 586 阅读 · 0 评论 -
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 08:40:27 · 475 阅读 · 0 评论 -
[LeetCode] Longest Common Prefix
Longest Common PrefixMy SubmissionsQuestion Solution Total Accepted: 68487 Total Submissions: 264798 Difficulty: EasyWrite a function to find the longest common prefix string原创 2015-10-10 13:57:58 · 389 阅读 · 0 评论 -
[LeetCode]First Missing Positive
First Missing PositiveMy SubmissionsQuestionTotal Accepted: 51712 Total Submissions: 224707 Difficulty: HardGiven an unsorted integer array, find the first missing positive int原创 2015-11-10 11:41:29 · 489 阅读 · 0 评论 -
[LeetCode]Substring with Concatenation of All Words
Substring with Concatenation of All WordsMy SubmissionsQuestionTotal Accepted: 42899 Total Submissions: 215720 Difficulty: HardYou are given a string, s, and a list of words, w原创 2015-10-28 15:47:54 · 417 阅读 · 0 评论 -
[LeetCode]Search in Rotated Sorted Array II
Search in Rotated Sorted Array IIMy SubmissionsQuestionTotal Accepted: 50992 Total Submissions: 162671 Difficulty: MediumFollow up for "Search in Rotated Sorted Array":What i原创 2015-12-02 19:22:20 · 431 阅读 · 0 评论 -
使用mahout下的朴素贝叶斯分类器对新闻分类
转载地址:http://www.letiantian.me/2014-10-22-mahout-naive-bayes-newsgroups/mahout版本是0.9;hadoop版本是1.2.1。下载数据集20 newsgroups dataset,解压后得到20news-bydate目录:$ cp -R 20news-bydate/*/* 2转载 2015-12-18 14:48:37 · 3904 阅读 · 1 评论 -
Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the转载 2015-11-26 23:39:07 · 435 阅读 · 0 评论 -
[LeetCode]Search for a Range
Search for a RangeMy SubmissionsQuestionTotal Accepted: 62397 Total Submissions: 225032 Difficulty: MediumGiven a sorted array of integers, find the starting and ending positio原创 2015-11-02 11:21:54 · 429 阅读 · 0 评论 -
[LeetCode]Search in Rotated Sorted Array
Search in Rotated Sorted ArrayMy SubmissionsQuestionTotal Accepted: 76870 Total Submissions: 264831 Difficulty: HardSuppose a sorted array is rotated at some pivot unknown to y原创 2015-11-02 10:22:35 · 393 阅读 · 0 评论 -
Jump Game II
Jump Game IIMy SubmissionsQuestionTotal Accepted: 52353 Total Submissions: 213392 Difficulty: HardGiven an array of non-negative integers, you are initially positioned at the f转载 2015-11-17 10:15:27 · 464 阅读 · 0 评论 -
[LeetCode]Decode Ways
Decode WaysMy SubmissionsQuestionTotal Accepted: 55371 Total Submissions: 330911 Difficulty: MediumA message containing letters from A-Z is being encoded to numbers using the原创 2015-12-08 20:20:34 · 586 阅读 · 0 评论 -
LeetCode问题 pow(x,n)
转载地址:http://blog.youkuaiyun.com/fengbingyang/article/details/12236121实现浮点类型的幂运算,函数原型为:double pow(double x, int n)下面介绍一下解决该问题的几种方法以及要注意的地方:1)最直观容易想到的方法就是用递归方法求n个x的乘积,注意考虑n的正负号,时间复杂度为O(n)转载 2015-11-21 14:39:04 · 422 阅读 · 0 评论 -
[LeetCode]Wildcard Matching
转载地址:http://www.cnblogs.com/felixfang/p/3708999.html开篇通常的匹配分为两类,一种是正则表达式匹配,pattern包含一些关键字,比如'*'的用法是紧跟在pattern的某个字符后,表示这个字符可以出现任意多次(包括0次)。另一种是通配符匹配,我们在操作系统里搜索文件的时候,用的就是这种匹配。比如 "*.pdf",'转载 2015-11-14 16:26:15 · 598 阅读 · 0 评论 -
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.使用动态规划,可以将时间原创 2015-05-27 15:15:56 · 393 阅读 · 0 评论 -
LeetCode Median of Two Sorted Arrays
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)).这个题目实际上就是先用快速排序进行合并,然后求中间原创 2015-05-13 00:10:44 · 551 阅读 · 0 评论 -
LeetCode Add Two Numbers
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 it as a link原创 2015-05-03 23:21:08 · 529 阅读 · 0 评论 -
LeetCode Single Number II
public class Solution { public int singleNumber(int [] A){ Arrays.sort(A); int n = A.length; for(int i=0;i<n-1;i+=3){ if(!(A[i]==A[i+1]&&A[i+1]==A[i+2])){ if(A[i]==A[i+1]){ return A原创 2014-10-18 19:31:52 · 529 阅读 · 0 评论 -
LeetCode: Copy List with Random Pointer
https://oj.leetcode.com/problems/copy-list-with-random-pointer/原创 2014-10-10 22:20:01 · 439 阅读 · 0 评论 -
LeetCode Word Break II
https://oj.leetcode.com/problems/word-break-ii/zh原创 2014-10-09 23:50:44 · 535 阅读 · 0 评论 -
LeetCode Linked List Cycle
https://oj.leetcode.com/problems/linked-list-cycle/原创 2014-10-09 20:02:05 · 503 阅读 · 0 评论 -
Binary Tree Preorder Traversal
https://oj.leetcode.com/problems/binary-tree-preorder-traversal/原创 2014-10-01 11:22:05 · 473 阅读 · 0 评论 -
LeetCode Word Break
https://oj.leetcode.com/problems/word-break/原创 2014-10-10 15:22:53 · 449 阅读 · 0 评论 -
LeetCode Linked List Cycle II
https://oj.leetcode.com/problems/linked-list-cycle-ii/接原创 2014-10-08 22:39:42 · 516 阅读 · 0 评论 -
LeetCode Binary Tree Postorder Traversal
点https://oj.leetcode.com/problems/binary-tree-postorder-traversal/接原创 2014-09-29 10:22:54 · 473 阅读 · 0 评论 -
Leet Reorder List
https://oj.leetcode.com/problems/reorder-list/原创 2014-10-05 23:16:18 · 587 阅读 · 0 评论 -
LeetCode Single Number
public class Solution { public int singleNumber(int [] A){ Arrays.sort(A); int n = A.length; for(int i=0;i<n-1;i+=2){ if(A[i]!=A[i+1]){ return A[i]; } } return A[n-1]; }}原创 2014-10-18 19:40:03 · 492 阅读 · 0 评论 -
LeetCode Candy
https://oj.leetcode.com/problems/candy/原创 2014-10-18 21:49:08 · 523 阅读 · 0 评论 -
LeetCode 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原创 2014-11-27 16:03:01 · 466 阅读 · 0 评论 -
LeetCode Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe原创 2015-05-03 22:47:51 · 387 阅读 · 0 评论 -
Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo原创 2015-05-11 11:09:56 · 351 阅读 · 0 评论 -
LeetCode
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 / \ 2 3Return 6.原创 2015-04-23 22:41:03 · 468 阅读 · 0 评论
分享