Skip to main content

150 docs tagged with "String"

View all tags

Check if Two Strings are Anagram (gfg)

This tutorial covers the solution to the Check if Two Strings are Anagram problem from the GeeksforGeeks website, featuring implementations in Python and C++.

Clone graph

This is a solution to the Clone graph problem on LeetCode.

Distinct SubSequence

Given two strings s and t, return the number of distinct subsequences of s which equals t. The test cases are generated so that the answer fits on a 32-bit signed integer.

Edit Distance(LeetCode)

Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.

Excel Sheet Column Title

Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.

Expressive Words

Given a string s and an array of query strings words, return the number of words that can be transformed into s by extending groups of identical characters in the word to have a size of three or more.

Find and Replace Pattern

Given a list of strings words and a string pattern, return words that match pattern where each unique character in pattern maps uniquely to characters in the word.

Find the Closest Palindrome

This document provides a solution where we need to find the nearest palindrome to a given number n, the idea is to generate potential palindromic candidates close to n and then determine which one is closest in terms of absolute difference.

Fizz Buzz(LeetCode)

Given an integer n, return a string array answer (1-indexed) where "FizzBuzz" if i is divisible by 3 and 5, "Fizz" if i is divisible by 3, "Buzz" if i is divisible by 5, i (as a string) if none of the above conditions are true.

Gas Station

This is a solution to the Gas station problem on LeetCode.

Implement strstr

This document provides solutions to check if a string is a substring of another.

Isomorphic Strings

This document provides solutions for determining if two strings are isomorphic.

K-Similar Strings

Determine the minimum number of adjacent letter swaps needed to transform string s1 into string s2, given that s1 and s2 are anagrams.

Largest Number(LeetCode)

Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.

Longest Uncommon Subsequence II

Given an array of strings strs, return the length of the longest uncommon subsequence between them. If the longest uncommon subsequence does not exist, return -1.

maximum number of potholes that can be fixed

The given Solution class uses a greedy approach to maximize the number of potholes repaired within the given budget by prioritizing the repair of larger contiguous pothole segments first.

Mini Parser

This is a solution to the Mini Parser problem on LeetCode.

Minimum Indexed Character

This document explores different approaches to solving the problem of finding the minimum index of a character in a string that is also present in another string, including solutions in JavaScript, TypeScript, Python, Java, and C++.

Minimum Window Substring(LeetCode)

Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string "".

Number of Atoms

This is a solution to the Number of Atoms problem on LeetCode.

Number of Lines To Write String

Write the string ss across multiple lines with each line no wider than 100 pixels, counting the total number of lines and the width of the last line, given the widths of each letter.

Open the Lock

This is a solution to the Open the Lock problem on LeetCode.

Orderly Queue

Given a string s and an integer k, return the lexicographically smallest string that can be formed by repeatedly moving one of the first k characters of s to the end of the string.

Permutation-2

Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order.

Regular Expression Matching (LeetCode)

Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where '.' matches any single character and '*' matches zero or more of the preceding element.

Reverse Words in a Given String (gfg)

This tutorial covers the solution to the Reverse Words in a Given String problem from the GeeksforGeeks website, featuring implementations in Python and C++.

Rotate String

This is a solution to the Rotate String problem on LeetCode.

Shortest Distance to a Character

Given a string ss and a character cc that appears in ss, return an array where each element at index ii represents the minimum distance from ii to any occurrence of cc in ss.

Shortest Palindrome

This document provides a solution to finding the shortest palindrome by adding characters in front of the given string.

Sort Characters By Frequency (LeetCode)

Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string.

Sort Characters By Frequency (LeetCode)

Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string.

Subdomain Visit Count

Given an array of count-paired domains, return an array showing the total visit counts for each subdomain and its parent domains.

Tag Validator

This is a solution to the Tag Validator problem on LeetCode.

Truncate Sentence

Given a sentence and a number k, truncate the sentence to the first k words.

Valid Anagram

This is a solution to the Valid Anagram problem on LeetCode.

Word Break(LeetCode)

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

Word Search II

This document provides a solution to the Word Search II problem, where we need to return all words on the board, given an mXn board of characters and a list of strings words.

Word Search(LeetCode)

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

Word Subsets

This is a solution to the Word Subsets problem on LeetCode.