LeetCode OJ
shijiebei2009
Java、PHP、Scala、Android、Python、ML、NLP
展开
-
Two Sum
仅提供个人的一种解题思路,未必是最优,仅供各位参考!import java.util.ArrayList;import java.util.Arrays;import java.util.List;/** * * * ClassName SolutionTwoSum * * * Description Given an array of integers, find原创 2014-09-11 16:35:54 · 1157 阅读 · 0 评论 -
Longest Consecutive Sequence
问题来源:https://leetcode.com/problems/longest-consecutive-sequence/import java.util.Arrays;/** * * <p> * ClassName LongestConsecutiveSequence * </p> * <p> * Description Given an unsorted array of i原创 2015-03-20 15:08:10 · 911 阅读 · 0 评论 -
Remove Nth Node From End of List
问题来源:https://leetcode.com/problems/remove-nth-node-from-end-of-list//** * * <p> * ClassName RemoveNthNodeFromEndOfList * </p> * <p> * Description Given a linked list, remove the nth node from th原创 2015-03-27 13:54:18 · 1189 阅读 · 0 评论 -
Path Sum
问题来源:https://leetcode.com/problems/path-sum/package cn.edu.shu;import java.util.ArrayList;import java.util.Iterator;import java.util.List;/** * * <p> * ClassName PathSum * </p> * <p> * Descrip原创 2015-03-27 19:09:26 · 1075 阅读 · 0 评论 -
Subsets
问题来源:https://leetcode.com/problems/subsets/import java.util.ArrayList;import java.util.Collections;import java.util.List;/** * * <p> * ClassName Subsets * </p> * <p> * Description Given a set原创 2015-03-21 10:14:34 · 956 阅读 · 0 评论 -
Unique Binary Search Trees
问题来源:https://leetcode.com/problems/unique-binary-search-trees//** * * <p> * ClassName UniqueBinarySearchTrees * </p> * <p> * Description Given n, how many structurally unique BST's (binary searc原创 2015-03-21 12:22:33 · 972 阅读 · 0 评论 -
Binary Tree Level Order Traversal
问题来源:https://leetcode.com/problems/binary-tree-level-order-traversal/package cn.edu.shu;import java.util.ArrayList;import java.util.LinkedList;import java.util.List;import java.util.Queue;/** * *原创 2015-03-28 11:25:52 · 1680 阅读 · 0 评论 -
Unique Binary Search Trees II
import java.util.ArrayList;import java.util.Iterator;import java.util.LinkedList;import java.util.List;import java.util.Queue;import org.junit.Test;/** * * <p>ClassName UniqueBinarySearchTressI原创 2015-03-23 17:00:51 · 1828 阅读 · 0 评论 -
Rotate Array
问题来源:https://leetcode.com/problems/rotate-array//** * * <p> * ClassName RotateArray * </p> * <p> * Description Rotate an array of n elements to the right by k steps. * * For example, with n =原创 2015-03-18 18:24:49 · 1375 阅读 · 0 评论 -
Count and Say
题目来源:https://leetcode.com/problems/count-and-say/import java.util.ArrayList;/** * * <p> * ClassName CountAndSay * </p> * <p> * Description The count-and-say sequence is the sequence of integers原创 2015-03-24 21:24:13 · 961 阅读 · 0 评论 -
Palindrome Number
问题来源:https://leetcode.com/problems/palindrome-number//** * * <p> * ClassName PalindromeNumber * </p> * <p> * Description Determine whether an integer is a palindrome(n. 回文). Do this without extr原创 2015-03-24 19:28:56 · 1045 阅读 · 0 评论 -
Pascal's Triangle II
问题来源:https://leetcode.com/problems/pascals-triangle-ii/import java.util.ArrayList;import java.util.List;/** * * <p> * ClassName PascalIsTriangleII * </p> * <p> * Description Given an index k, r原创 2015-03-27 14:22:49 · 1096 阅读 · 0 评论 -
Min Stack
问题来源:https://leetcode.com/problems/min-stack/import java.util.Iterator;import java.util.Stack;/** * * <p> * ClassName MinStack * </p> * <p> * Description Design a stack that supports push, pop,原创 2015-03-26 20:06:57 · 953 阅读 · 0 评论 -
Best Time To Buy And Sell Stock
仅提供个人的一种解题思路,未必是最优,仅供各位参考!/** * * * ClassName SolutionBestTimeToBuyAndSellStock * * * Description Say you have an array for which the ith element is the price of a given stock on day i.原创 2014-09-11 21:16:51 · 1007 阅读 · 0 评论 -
Reverse Words In A String
仅提供个人的一种解题思路,未必是最优,仅供各位参考!原创 2014-09-11 16:34:01 · 1066 阅读 · 0 评论 -
Evaluate Reverse Polish Notation
仅提供个人的一种解题思路,未必是最优,仅供各位参考!import java.util.Stack;/** * * * ClassName SolutionEvaluateReversePolishNotation * * * Description 该题是解逆波兰表达式 Evaluate the value of an arithmetic expression i原创 2014-09-11 20:59:35 · 954 阅读 · 0 评论 -
Excel Sheet Column Number
问题来源:https://leetcode.com/problems/excel-sheet-column-number//** * * <p> * ClassName ExcelSheetColumnNumber * </p> * <p> * Description Related to question Excel Sheet Column Title * * Given a原创 2015-03-25 22:12:35 · 1764 阅读 · 0 评论 -
Climbing Stairs
/** * * <p> * ClassName ClimbingStairs * </p> * <p> * Description 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原创 2015-03-19 21:55:18 · 963 阅读 · 0 评论 -
Compare Version Numbers
问题来源:https://leetcode.com/problems/compare-version-numbers//** * * <p> * ClassName CompareVersionNumbers * </p> * <p> * Description Compare two version numbers version1 and version2. If version1原创 2015-03-26 13:28:38 · 1301 阅读 · 0 评论 -
Intersection of Two Linked Lists
问题来源:https://leetcode.com/problems/intersection-of-two-linked-lists//** * * <p> * ClassName IntersectionOfTwoLinkedLists * </p> * <p> * Description Write a program to find the node at which the原创 2015-03-26 14:26:42 · 1018 阅读 · 0 评论 -
Excel Sheet Column Title
问题来源:https://leetcode.com/problems/excel-sheet-column-title//** * * <p> * ClassName ExcelSheetColumnTitle * </p> * <p> * Description Given a positive integer, return its corresponding column tit原创 2015-03-26 12:51:27 · 1456 阅读 · 0 评论 -
ZigZag Conversion
问题来源:https://leetcode.com/problems/zigzag-conversion/import java.util.ArrayList;import java.util.Iterator;import java.util.List;/** * * <p> * ClassName ZigZagConversion * </p> * <p> * Descript原创 2015-03-26 19:19:14 · 955 阅读 · 0 评论 -
Roman to Integer
问题来源:https://leetcode.com/problems/roman-to-integer//** * * <p> * ClassName RomanToInteger * </p> * <p> * Description Given a roman numeral, convert it to an integer. * * Input is guaranteed原创 2015-03-26 22:32:14 · 880 阅读 · 0 评论 -
Pascal's Triangle
问题来源:https://leetcode.com/problems/pascals-triangle/import java.util.ArrayList;import java.util.List;/** * * <p> * ClassName PascalIsTriangle * </p> * <p> * Description Given numRows, generate原创 2015-03-24 22:11:34 · 1008 阅读 · 0 评论