101 Logo
onenoughtone

Practice Problems

Reinforce Your Learning

Practice these string problems to strengthen your understanding of string manipulation concepts.

Difficulty Levels:

EasyMediumHard

Reverse String

Easy

Write a function that reverses a string. The input string is given as an array of characters.

Example:

Input: ["h","e","l","l","o"]
Output: ["o","l","l","e","h"]

Constraints:

  • Do this in-place with O(1) extra memory.

Valid Anagram

Easy

Given two strings s and t, return true if t is an anagram of s, and false otherwise.

Example:

Input: s = "anagram", t = "nagaram"
Output: true

Constraints:

  • The strings contain only lowercase English letters.

Longest Palindromic Substring

Medium

Given a string s, return the longest palindromic substring in s.

Example:

Input: s = "babad"
Output: "bab" or "aba" (both are valid)

IntroVisualizePractice
101 Logo
onenoughtone