![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
文章平均质量分 67
ld_zju
这个作者很懒,什么都没留下…
展开
-
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-11-07 00:18:10 · 133 阅读 · 0 评论 -
LeetCode Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.这个题按照罗马数字的计数方法直接模拟就好,关于罗马数字的计数方法可以参考百度百科:http://baike.baidu.com/link?url=uRFEbVjfAx0do原创 2015-11-13 09:23:27 · 214 阅读 · 0 评论 -
LeetCode Range Sum Query - Immutable
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sumRan原创 2015-11-11 22:48:25 · 216 阅读 · 0 评论 -
LeetCode 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-11-10 09:30:59 · 180 阅读 · 0 评论 -
LeetCode String to Integer (atoi)
Implement atoi to convert a string to an integer.Requirements for atoi:The function first discards as many whitespace characters as necessary until the first non-whitespace character is foun原创 2015-11-10 10:21:09 · 239 阅读 · 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-11-10 08:58:24 · 233 阅读 · 0 评论 -
LeetCode Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.题意是数组存储的是一个数的每位数字,然后原创 2015-11-09 10:47:27 · 233 阅读 · 0 评论 -
LeetCode Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with原创 2015-11-09 10:13:46 · 197 阅读 · 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-11-09 09:24:29 · 232 阅读 · 0 评论 -
Palindrome Number
leetcode easy中的水题一个,负数不是回文,而且不用考虑把数逆转后是否溢出的情况也能AC,逆转后溢出两个数应该不会相等class Solution {public: bool isPalindrome(int x) { if(x < 0) return false; if(x < 0) x =原创 2015-11-09 08:54:24 · 257 阅读 · 0 评论 -
Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321这个题第一眼看上去比较简单,直接写出如下代码int reverse(int x) { if(x == 0) return x; int原创 2015-11-08 19:54:57 · 193 阅读 · 0 评论 -
LeetCode 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-11-17 08:22:25 · 215 阅读 · 0 评论