没有合适的资源?快使用搜索试试~ 我知道了~
Example 1: Input: s = "PAYPALISHIRING", numRows = 3
资源推荐
资源详情
资源评论
1.Two Sum(easy)
Given an array of integers, return indices of the two numbers such that they add up to a
specific target.
You may assume that each input would have exactly one solution, and you may not use
the same element twice.
Example:
Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].
输入:
[3,2,4]
6
输出:
[1,2]
2. Add Two Numbers(medium)
Medium
65061693FavoriteShare
You are given two non-empty linked lists representing two non-negative integers. 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 linked list.
You may assume the two numbers do not contain any leading zero, except the number 0
itself.
Example:
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Explanation: 342 + 465 = 807.
3. Longest Substring Without Repeating
Characters(medium)
Medium
7087418FavoriteShare
Given a string, find the length of the longest substring without repeating characters.
Example 1:
Input: "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.
Example 2:
Input: "bbbbb"
Output: 1
Explanation: The answer is "b", with the length of 1.
Example 3:
Input: "pwwkew"
Output: 3
Explanation: The answer is "wke", with the length of 3.
Note that the answer must be a substring, "pwke" is a subsequence
and not a substring.
4. Median of Two Sorted Arrays(hard)
Hard
5490812FavoriteShare
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays. The overall run time complexity should be
O(log (m+n)).
You may assume nums1 and nums2 cannot be both empty.
Example 1:
nums1 = [1, 3]
nums2 = [2]
The median is 2.0
Example 2:
nums1 = [1, 2]
nums2 = [3, 4]
The median is (2 + 3)/2 = 2.5
5. Longest Palindromic Substring(medium)
Medium
4908434FavoriteShare
Given a string s, find the longest palindromic substring in s. You may assume that the
maximum length of s is 1000.
Example 1:
Input: "babad"
Output: "bab"
Note: "aba" is also a valid answer.
Example 2:
Input: "cbbd"
Output: "bb"
6. ZigZag Conversion(medium)
Medium
13253947Add to ListShare
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 N
A P L S I I G
Y I R
And then read line by line: "PAHNAPLSIIGYIR"
Write the code that will take a string and make this conversion given a number of rows:
string convert(string s, int numRows);
Example 1:
Input: s = "PAYPALISHIRING", numRows = 3
Output: "PAHNAPLSIIGYIR"
Example 2:
Input: s = "PAYPALISHIRING", numRows = 4
Output: "PINALSIGYAHRPI"
Explanation:
P I N
A L S I G
Y A H R
P I
7. Reverse Integer(easy)
Given a 32-bit signed integer, reverse digits of an integer.
Example 1:
Input: 123
Output: 321
Example 2:
Input: -123
Output: -321
Example 3:
Input: 120
Output: 21
Note:
Assume we are dealing with an environment which could only hold integers within the
32-bit signed integer range. For the purpose of this problem, assume that your function
returns 0 when the reversed integer overflows.
8. String to Integer (atoi)(medium)
Medium
12427564Add to ListShare
Implement atoi which converts a string to an integer.
The function first discards as many whitespace characters as necessary until the first
non-whitespace character is found. Then, starting from this character, takes an optional
initial plus or minus sign followed by as many numerical digits as possible, and interprets
them as a numerical value.
The string can contain additional characters after those that form the integral number,
which are ignored and have no effect on the behavior of this function.
If the first sequence of non-whitespace characters in str is not a valid integral number, or
if no such sequence exists because either str is empty or it contains only whitespace
characters, no conversion is performed.
剩余323页未读,继续阅读
资源评论
鲸阮
- 粉丝: 18
- 资源: 303
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功