随笔分类 - [LeetCode 题解]
LeetCode 个人的题解,加一些愚见~欢迎探讨
摘要:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo
阅读全文
摘要:前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to ...
阅读全文
摘要:前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Given an array with n objects colored red, white or blue, sort them so that objects of the same color a...
阅读全文
摘要:Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thi
阅读全文
摘要:前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Given an array of integers, find two numbers such that they add up to a specific target number. The fu...
阅读全文
摘要:前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Find the contiguous subarray within an array (containing at least one number) which has the largest sum...
阅读全文
摘要:前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You h...
阅读全文
摘要:题目描述: The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the tot
阅读全文
摘要: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 l
阅读全文
摘要:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l
阅读全文
摘要:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point ...
阅读全文
摘要:Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return 转载请注明出处: http://www.cnblogs.com/double-win/ 谢谢!
阅读全文
摘要:前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numb...
阅读全文
摘要:前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Implement pow(x, n). 2. 思路 题目很精简,不过需要考虑的情况很多,特别的需要注意 n可能为0 或者负数的情况。 另外,通过二分法,可以减少计算量。 3. 解法 clas...
阅读全文
摘要:前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Given a non-negative number represented as an array of digits, plus one to the number. The digits ar...
阅读全文
摘要:前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 The string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you ma...
阅读全文