All problems
› String problems
String problems
186 String DSA practice problems on CampusCode, each with statement, examples and constraints.
150. Reverse a String
Easy
String
151. Check if String is Palindrome
Easy
String
152. Count Vowels and Consonants
Easy
String
153. Remove All Spaces from a String
Easy
String
154. Count Occurrences of a Character
Easy
String
155. Check if Two Strings are Anagrams
Easy
String
156. Find the First Non-Repeating Character
Easy
String
157. Check if String Contains Only Digits
Easy
String
158. Remove Duplicate Characters from String
Easy
String
159. Reverse Words in a Sentence
Easy
String
160. Find the Length of Last Word
Easy
String
161. Check if String is a Subsequence of Another
Easy
String
162. Roman to Integer
Easy
String
163. Longest Common Prefix
Easy
String
164. Add Binary Strings
Easy
String
165. Valid Parentheses (String Version)
Easy
String
166. Detect Capital Usage
Easy
String
167. To Lower Case
Easy
String
168. Count and Say
Easy
String
169. Merge Strings Alternately
Easy
String
170. Check if Strings are Isomorphic
Easy
String
171. Word Pattern
Easy
String
172. Find the Difference (One Extra Character)
Easy
String
173. Ransom Note
Easy
String
174. String Compression (Run-Length Encoding)
Easy
String
175. Repeated Substring Pattern
Easy
String
176. Check if String is a Rotation of Another
Easy
String
177. Maximum Nesting Depth of Parentheses
Easy
String
178. Find the Index of the First Occurrence in a String
Easy
String
179. Longest Continuous Repeating Character
Easy
String
180. Number of Segments in a String
Easy
String
181. Find All Occurrences of a Substring
Easy
String
182. Maximum Number of Words in Sentences
Easy
String
183. Truncate Sentence
Easy
String
184. Check if Pangram
Easy
String
185. Sorting the Sentence
Easy
String
186. Goal Parser Interpretation
Easy
String
187. Reverse Prefix of Word
Easy
String
188. Remove Vowels from String
Easy
String
189. Largest Odd Number in String
Easy
String
190. Longest Substring Without Repeating Characters (Brute)
Easy
String
191. Count Prefix and Suffix Pairs
Easy
String
192. Check if Binary String Has at Most One Segment of Ones
Easy
String
193. Remove Trailing Zeros from String
Easy
String
194. Count Substrings Starting and Ending with Given Character
Easy
String
195. String Without AAA or BBB
Easy
String
196. Concatenation of Consecutive Binary Numbers (String)
Easy
String
197. Check Distances Between Same Letters
Easy
String
198. Replace All Digits with Characters
Easy
String
199. Check if Two String Arrays are Equivalent
Easy
String
200. Make the String Great (Remove Same Adjacent)
Easy
String
201. Shuffle String
Easy
String
202. Integer to Roman
Easy
String
203. Decode the Message
Easy
String
204. Capitalize the First Letter of Every Word
Easy
String
205. Shift the Letters
Easy
String
206. Minimum Number of Moves to Seat Everyone
Easy
String
207. Largest Number (Array to String Sort)
Easy
String
208. Decode String (Nested Brackets — Easy Variant)
Easy
String
209. Longest Substring with At Most Two Distinct Characters
Easy
String
210. Longest Substring Without Repeating Characters
Medium
String
211. Longest Palindromic Substring
Medium
String
212. Group Anagrams
Medium
String
213. Longest Palindrome by Rearranging Characters
Medium
String
214. Minimum Window Substring
Medium
String
215. String to Integer (atoi)
Medium
String
216. ZigZag Conversion
Medium
String
217. Multiply Strings
Medium
String
218. Decode Ways
Medium
String
219. Word Break
Medium
String
220. Generate Parentheses (Count)
Medium
String
221. Letter Combinations of a Phone Number (Count)
Medium
String
222. Restore IP Addresses (Count)
Medium
String
223. Count Palindromic Substrings
Medium
String
224. Longest Repeating Character Replacement
Medium
String
225. Valid Palindrome II
Medium
String
226. Palindrome Partitioning (Count)
Medium
String
227. Reorganize String (Feasibility)
Medium
String
228. Find All Anagrams in a String (Count)
Medium
String
229. Permutation in String
Medium
String
230. Compare Version Numbers
Medium
String
231. Reverse Words in a String
Medium
String
232. Simplify Path
Medium
String
233. Basic Calculator II
Medium
String
234. Decode String
Medium
String
235. Custom Sort String
Medium
String
236. Partition Labels (Count)
Medium
String
237. Count Distinct Subsequences (Modulo 10^9+7)
Medium
String
238. String Compression (Length)
Medium
String
239. Remove K Digits
Medium
String
240. Remove Duplicate Letters
Medium
String
241. Text Justification (Line Count)
Medium
String
242. Sort Characters By Frequency
Medium
String
243. Find the Index of the First Occurrence
Medium
String
244. Repeated DNA Sequences (Count)
Medium
String
245. Isomorphic Strings
Medium
String
246. Reverse Vowels of a String
Medium
String
247. Largest Number
Medium
String
248. Number of Distinct Substrings (Count)
Medium
String
249. Minimum Add to Make Parentheses Valid
Medium
String
250. Longest Substring with At Most K Distinct Characters
Medium
String
251. Substring with Concatenation of All Words (Count)
Medium
String
252. Find Longest Word by Deleting Characters
Medium
String
253. CamelCase Matching (Count)
Medium
String
254. Maximum Number of Vowels in a Substring of Given Length
Medium
String
255. Defanging an IP Address
Medium
String
256. Bulls and Cows
Medium
String
257. Edit Distance
Hard
String
258. Wildcard Matching
Hard
String
259. Regular Expression Matching
Hard
String
260. Longest Valid Parentheses
Hard
String
261. Distinct Subsequences (Count Target in Source)
Hard
String
262. Word Break II (Count of Segmentations)
Hard
String
263. Shortest Palindrome (Prepend Count)
Hard
String
264. Palindrome Pairs (Count)
Hard
String
265. Minimum Window Subsequence (Length)
Hard
String
266. Scramble String
Hard
String
267. Interleaving String
Hard
String
268. Longest Duplicate Substring (Length)
Hard
String
269. Word Ladder (Shortest Transformation Length)
Hard
String
270. Concatenated Words (Count)
Hard
String
271. Valid Number
Hard
String
272. Count Different Palindromic Subsequences (Modulo 10^9+7)
Hard
String
273. Palindrome Partitioning II (Minimum Cuts)
Hard
String
274. Distinct Echo Substrings (Count)
Hard
String
275. Last Substring in Lexicographical Order
Hard
String
276. Minimum Insertions to Make a Palindrome
Hard
String
277. Minimum Insertions to Balance Parentheses
Hard
String
278. Longest Substring with At Least K Repeating Characters
Hard
String
279. Basic Calculator
Hard
String
280. Different Ways to Add Parentheses (Count)
Hard
String
281. Expression Add Operators (Count)
Hard
String
282. Ambiguous Coordinates (Count)
Hard
String
283. Number of Ways to Form Target String (Modulo 10^9+7)
Hard
String
284. Stamping The Sequence (Stamp Count)
Hard
String
285. Integer to English Words
Hard
String
286. Parse Lisp Expression
Hard
String
287. Number of Atoms
Hard
String
288. Encode String with Shortest Length
Hard
String
289. Distinct Subsequences II (Modulo 10^9+7)
Hard
String
290. Partition into Substrings with Unique Characters
Hard
String
291. Shortest Superstring (Length)
Hard
String
292. Count Substrings That Differ by One Character
Hard
String
293. Longest Happy Prefix (Length)
Hard
String
294. Strong Password Checker (Minimum Steps)
Hard
String
295. Count Generalized Abbreviations (Modulo 10^9+7)
Hard
String
296. Special Binary String
Hard
String
412. Find All Anagrams via Sliding Window
Hard
Linked List
557. Longest Substring with At Most K Replacements
Hard
Binary Search
564. Check Balanced Parentheses
Easy
Stack
565. Reverse a String Using Stack
Easy
Stack
567. Convert Infix to Postfix
Easy
Stack
572. Check if Stack is Palindrome
Easy
Stack
575. Valid Parentheses (Multiple Types)
Easy
Stack
576. Remove All Adjacent Duplicates in String
Easy
Stack
577. Make String Great
Easy
Stack
587. First Non-Repeating Character in Stream
Easy
Stack
597. Balanced Brackets with Wildcard
Easy
Stack
598. Maximum Nesting Depth of Parentheses
Easy
Stack
601. Delete Consecutive Same Words
Easy
Stack
602. Count Pairs of Matching Parentheses
Easy
Stack
603. Simplify Unix Directory Path
Easy
Stack
604. Score of Parentheses
Easy
Stack
605. Remove K Digits to Get Smallest Number
Easy
Stack
612. Decode String (Nested Brackets)
Medium
Stack
615. Remove Duplicate Letters
Medium
Stack
634. Count Collisions on a Road
Medium
Stack
635. Minimum Add to Make Parentheses Valid
Medium
Stack
636. Minimum Insertions to Balance Parentheses
Medium
Stack
637. Longest Valid Parentheses
Medium
Stack
638. Number of Atoms
Medium
Stack
648. Removing Stars From a String
Medium
Stack
651. Check If Word Is Valid After Substitutions
Medium
Stack
652. Implement a Basic Calculator II
Medium
Stack
656. Basic Calculator I
Hard
Stack
657. Basic Calculator III
Hard
Stack
658. Longest Valid Parentheses (O(1) Space)
Hard
Stack
659. Remove Invalid Parentheses
Hard
Stack
665. Minimum Swaps to Make String Balanced
Hard
Stack
930. Replace Words Using Trie (Sentence Shortening)
Medium
Trees
948. Palindrome Pairs (Trie Approach)
Hard
Trees
949. Stream of Characters (Aho-Corasick Lite)
Hard
Trees
1288. Invert Case of All Characters in a String
Easy
Bit Manipulation
1321. Find the Difference Between Two Strings (XOR)
Easy
Bit Manipulation
1329. Power Set Using Bitmask
Medium
Bit Manipulation
1345. Stickers to Spell Word — Bitmask DP
Medium
Bit Manipulation