Given a string s, the task is to find the length of the longest substring without any repeating characters.
Input: `s = "abcabcbb"`
Output: `3`
Explanation: The longest substring without repeating characters is "abc", which has a length of 3.
Input: `s = "bbbbb"`
Output: `1`
Explanation: The longest substring without repeating characters is "b", which has a length of 1.
Input: `s = "pwwkew"`
Output: `3`
Explanation: The longest substring without repeating characters is "wke", which has a length of 3. Note that "pwke" is not a substring as it contains repeating characters.
0 <= s.length <= 5 * 10^4sconsists of English letters, digits, symbols, and spaces.
Given a string s, return the longest palindromic substring in s.
Input: `s = "babad"`
Output: `"bab"`
Explanation: `"aba"` is also a valid answer.
Input: `s = "cbbd"`
Output: `"bb"`
- 1 <=
s.length<= 1000 sconsists of only digits and English letters.
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
APLSIIG
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);
Input: s = "PAYPALISHIRING", numRows = 3
Output: "PAHNAPLSIIGYIR"
Input: s = "PAYPALISHIRING", numRows = 4
Output: "PINALSIGYAHRPI"
Explanation:
P I N
A L S I G
Y A H R
P I
Input: s = "A", numRows = 1
Output: "A"
1 <= s.length <= 1000sconsists of English letters (lower-case and upper-case),','and'.'.1 <= numRows <= 1000