0% found this document useful (0 votes)
5 views

Leet code practice question

The document presents five coding problems: finding the longest palindromic substring, decoding a string based on a specific format, grouping anagrams from an array of strings, identifying the minimum window substring containing all characters of another string, and converting a string into a zigzag pattern based on a specified number of rows. Each problem includes example inputs and outputs, as well as constraints on the input sizes. These problems are designed to test algorithmic skills and string manipulation techniques.

Uploaded by

lokesh31052k3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Leet code practice question

The document presents five coding problems: finding the longest palindromic substring, decoding a string based on a specific format, grouping anagrams from an array of strings, identifying the minimum window substring containing all characters of another string, and converting a string into a zigzag pattern based on a specified number of rows. Each problem includes example inputs and outputs, as well as constraints on the input sizes. These problems are designed to test algorithmic skills and string manipulation techniques.

Uploaded by

lokesh31052k3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Longest Palindromic Substring


💡 Problem:
Given a string s, return the longest palindromic substring in s.
🔹 Example:
Input: s = "babad"
Output: "bab"
Explanation: "aba" is also a valid answer.
🔹 Constraints:
 1 <= s.length <= 1000
 s consists only of lowercase English letters.

2. Decode String
💡 Problem:
Given an encoded string, return its decoded form.
The encoding rule is: k[encoded_string], where encoded_string inside the
brackets is repeated k times.
You may assume that the input string is always valid.
🔹 Example:
Input: s = "3[a]2[bc]"
Output: "aaabcbc"
🔹 Constraints:
 1 <= s.length <= 30
 s contains only digits, square brackets, and lowercase English
letters.

3. Group Anagrams
💡 Problem:
Given an array of strings strs, group anagrams together.
An anagram is a word or phrase formed by rearranging the letters of a different
word.
🔹 Example:
Input: strs = ["eat","tea","tan","ate","nat","bat"]
Output: [["bat"],["nat","tan"],["ate","eat","tea"]]
🔹 Constraints:
 1 <= strs.length <= 10^4
 strs[i] consists of lowercase English letters.

4. Minimum Window Substring


💡 Problem:
Given two strings s and t, return the minimum window substring of s that
contains all characters of t.
If there is no such substring, return "" (empty string).
🔹 Example:
Input: s = "ADOBECODEBANC", t = "ABC"
Output: "BANC"
🔹 Constraints:
 1 <= s.length, t.length <= 10^5
 s and t consist of uppercase and lowercase English letters.

5. Zigzag Conversion
💡 Problem:
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of
rows.
You need to return the converted string when read row-wise.
🔹 Example:
Input: s = "PAYPALISHIRING", numRows = 3
Output: "PAHNAPLSIIGYIR"
Explanation:
P A H N
APLSIIG
Y I R
🔹 Constraints:
 1 <= s.length <= 1000
 1 <= numRows <= 1000

You might also like