1. 题目 Given an array of integers, return indices of the two numbers such that they add up to a specific target…
分类:LeetCode题目解答
【Leetcode】2. Add Two Numbers 两个链表的对应元素加和的新链表
1. 题目 You are given two linked lists representing two non-negative numbers. The digits are stored in reverse o…
【Leetcode】3. Longest Substring Without RepeatingCharacters无重最长子串
1. 题目 Given a string, find the length of the longest substring without repeating characters. Examples: Given &…
【leetcode】4. Median of Two Sorted Arrays 两个有序数组组成集合的中位数
1. 题目 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sor…
【leetcode】5. Longest Palindromic Substring 最长回文子串
1. 题目 Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of…
【Leetcode】6. ZigZag Conversion
1. 题目 The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like th…
【Leetcode】7. Reverse Integer 整数字面反转
1. 题目 Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 2. 思路 如果是负数,先…
【Leetcode】8. String to Integer (atoi) 字符串转整型
1. 题目 Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If …
【Leetcode】9. Palindrome Number 判断一个数字是否是回文数字
1. 题目 Determine whether an integer is a palindrome. Do this without extra space. 2. 思路 反转后和自身比较是否相等。不需要考虑溢出,因为…
【leetcode】10. Regular Expression Matching 简易正则匹配
1. 题目 Implement regular expression matching with support for ‘.’ and ‘*’. ‘.R…
【Leetcode】11. Container With Most Water 数列中选两个值使得中间的面积最大
1. 题目 Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). …
【Leetcode】12. Integer to Roman 阿拉伯数字转罗马数字
1. 题目 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 39…