- 博客(10)
- 收藏
- 关注
原创 Leetcode---Integer to Roman & Roman to Integer
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 num) { String[][] base = new ...
2018-03-20 20:17:10
155
原创 Leetcode---Valid Palindrome
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 car" is not a palindrom...
2018-03-20 16:53:53
144
原创 Leetcode---Insertion Sort List
Sort a linked list using insertion sort./** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * ...
2018-03-17 10:23:48
161
原创 Leetcode---Single Number I & II
Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra me...
2018-03-16 20:20:34
205
原创 Leetcode---Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting the intege...
2018-03-15 17:26:27
161
原创 Leetcode---Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Have you thought about this?Here are some good questions to ask before coding. Bonus points for you if you have...
2018-03-15 16:22:35
118
原创 Leetcode---Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.import java.util.Stack;public class Solutio...
2018-03-15 15:59:25
211
原创 Leetcode---Best Time to Buy and Sell Stock III
Say you have an array for which the i th element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note: You may not enga...
2018-03-14 22:26:03
147
原创 Leetcode---Best Time to Buy and Sell Stock I & II
Say you have an array for which the i th element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), de...
2018-03-14 16:53:14
142
原创 Leetcode---Maximum Depth of Binary Tree & Minimum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node./** * Definition for binary tree * publi...
2018-03-14 15:37:43
139
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人