Posts with tag 'string'

Anagram Substrings

less than 1 minute read

Given two strings s0 and s1, return the number of substrings where s1 contains any anagram of s0.

Anagram Partitioning

1 minute read

You are given two non-empty strings a and b that are the same length. Partition them into substrings such that each pair of a and b’s substring is the same s...

String Equivalence Relations

1 minute read

You are given three lowercase alphabet strings a, b and target. Strings a and b have the same length and are defined to be equivalent: a[i] = b[i]. For examp...

Minimum Window Substring

less than 1 minute read

Given two lowercase alphabet strings a and b, return the length of a minimum substring in a that contains all the characters of b.

String Expansion

less than 1 minute read

You are given a string s consisting of lowercase alphabet characters, digits, and brackets"(" and ")". s encodes a longer string and is represented as concat...

Repeated Deletion Sequel

less than 1 minute read

Given a string s and an integer k, repeatedly delete the earliest k consecutive duplicate characters.

Edit Distance

1 minute read

Given two strings a and b, find the minimum edit distance between the two. One edit distance is defined as

Odd Palindrome

less than 1 minute read

Given a string s, return whether all its palindromic substrings have odd lengths.

Unique String Frequencies

less than 1 minute read

Given a lowercase alphabet string s, return the minimum number of characters that we need to delete such that the frequency of each character occurs a unique...

Distinct Substrings

less than 1 minute read

Given a string s, return the number of distinct non-empty substrings.

Longest 1s After One Flip

less than 1 minute read

You are given a string s containing 1s and 0s. Given that you can flip at most one "0", return the length of the longest contiguous substring of 1s.

Vertical Word Arrangement

less than 1 minute read

You are given a string s containing lowercase alphabet characters separated by spaces " ". After splitting the string on spaces, return all the words in vert...

Characters in Each Bracket Depth

1 minute read

You are a given a string s containing "X", "(", and ")". The string has balanced brackets and in between there are some "X"s along with possibly nested brack...

Bulk Shift Letters

1 minute read

You are given a lowercase alphabet string s and a list of integers shifts. Each element shifts[i] means to shift the first i + 1 letters of s by shifts[i] po...

Split String with Same Distinct Counts

less than 1 minute read

You are given a lowercase alphabet string s. Return the number of ways to split the string into two strings such that the number of distinct characters in ea...

Delete Characters to Equalize Strings

less than 1 minute read

Given two lowercase alphabet strings a and b, consider an operation where we delete any character in either string. Return the minimum number of operations r...

Add Binary Numbers

less than 1 minute read

Given two strings a and b that represent binary numbers, add them and return their sum, also as a string.

Subsequence Strings

less than 1 minute read

Given two lowercase alphabet strings s1 and s2, determine if s1 is a subsequence of s2.

Split String Into K Palindromes

less than 1 minute read

Given a lowercase alphabet string s and an integer k, you want to divide the string into k disjoint parts such that each part is a palindrome. Return the min...

Shortest Common Supersequence

less than 1 minute read

Given strings a and b, return the length of the shortest string that has both a and b as subsequences.

Longest Palindromic Subsequence

less than 1 minute read

Given a string s with all lower case characters, find the length of the longest palindromic subsequence in s.

Removing Parentheses

less than 1 minute read

Given a string of parentheses s, return the minimum number of parentheses to be removed to make the string balanced.

Partition String

less than 1 minute read

Given a lowercase alphabet string s, partition s into as many pieces as possible such that each letter appears in at most one piece and return the sizes of t...

Longest Anagram Subsequence

less than 1 minute read

Given two lowercase alphabet strings a and b, return the length of the longest anagram subsequence.

Balanced Brackets Sequel

less than 1 minute read

Given a string s containing round, curly, and square open and closing brackets, return whether the brackets are balanced.

Palindromic Anagram

less than 1 minute read

Given a string s, determine whether any anagram of s is a palindrome.

Count Substrings With All 1s

less than 1 minute read

You are given a string s containing "1"s and "0"s. Return the number of substrings that contain only "1"s. Mod the result by 10 ** 9 + 7.

Anagram Checks

less than 1 minute read

Given two strings s0 and s1, return whether they are anagrams of each other.

Maximize Binary String Score

1 minute read

You are given a binary string s containing "1"s and "0"s. Consider splitting the string into two non-empty substrings such that a + b = s. The score of this ...

Word Formation

1 minute read

Given a list of strings words and a string letters, return the length of longest string in words that can be made from letters in letters. If no word can be ...

Vertical Cipher

less than 1 minute read

Given a string s and an integer k, rearrange s into k rows so that s can be read vertically (top-down, left to right).

Unique Ab Strings

less than 1 minute read

You are given a string s of "a" and "b"s. "a"s can stay "a" or turn into "b", but "b"s can’t change.

Swap Characters to Equalize Strings

less than 1 minute read

You are given two lowercase alphabet strings s and t, both of them the same length. You can pick one character in s and another in t and swap them. Given you...

Stuck Keyboard

1 minute read

You are given two strings typed and target. You want to write target, but the keyboard is stuck so some characters may be written 1 or more times. Return whe...

String Isomorphism

1 minute read

Given lowercase alphabet strings s, and t return whether you can create a 1-to-1 mapping for each letter in s to another letter (could be the same letter) su...

String Addition

less than 1 minute read

Given two strings a, and b, both representing an integer, add them and return it in the same string representation.

Smallest Number With No Adjacent Duplicates

less than 1 minute read

You are given a string s containing "1", "2", "3" and "?". Given that you can replace any “?” with "1", "2" or "3", return the smallest number you can make a...

Shortest String

less than 1 minute read

Given a string s consisting only of "1"s and "0"s, you can delete any two adjacent letters if they are different.

Run-Length Encoding

less than 1 minute read

Given a string s, return its run-length encoding. You can assume the string to be encoded have no digits and consists solely of alphabetic characters.

Run-Length Decoded String Iterator

less than 1 minute read

Given a run-length encoded lowercase alphabet string s, implement an iterator which is the decoded version of s:

Rotation of Another String

1 minute read

Given two alphabet (can be lower and/or uppercase) strings s0 and s1, determine if one is a rotation of the other.

Rookie Mistake

1 minute read

You’re given a string s containing letters of three types, R, B, and ..

Roman Numeral to Integer

2 minute read

Given a string numeral representing a Roman numeral, convert it to an integer.

Reverse Words

less than 1 minute read

Given a string s of words delimited by spaces, reverse the order of words.

Repeating String

less than 1 minute read

Given a lowercase alphabet string s, return whether it’s a repeating string.

Repeated Deletion

less than 1 minute read

Given a string s, repeatedly delete the earliest consecutive duplicate characters.

Remove One Letter

less than 1 minute read

Given two strings s0 and s1, return whether you can obtain s1 by removing 1 letter from s0.

Recurring Character

less than 1 minute read

Given a lowercase alphabet string s, return the index of the first recurring character in it. If there are no recurring characters, return -1.

Parentheses Grouping

less than 1 minute read

Given a string s containing balanced parentheses "(" and ")", split them into the maximum number of balanced groups.

Number of Unique Character Substrings

less than 1 minute read

Given a lowercase alphabet string s, return the total number of substrings that contain one unique character.

Minimum Bracket Addition

less than 1 minute read

Given a string s containing brackets ( and ), return the minimum number of brackets that can be inserted so that the brackets are balanced.

Longest Common Prefix

less than 1 minute read

Given a list of lowercase alphabet strings words, return the longest common prefix.

Lexicographic Swap

less than 1 minute read

Given a string s, return the lexicographically smallest string that can be made if you can make at most one swap between two characters in the string.

Interleaved String

less than 1 minute read

Given two strings s0 and s1, return the two strings interleaved, starting with s0. If there are leftover characters in a string they should be added to the e...

Index Into an Infinite String

less than 1 minute read

You are given an alphabet (can be lower or uppercase) string s and two integers i and j where i < j. Let’s say p is an infinite string of s repeating fore...

Compress String

less than 1 minute read

Given a string lowercase alphabet s, eliminate consecutive duplicate characters from the string and return it.

Closest Distance to Character

less than 1 minute read

Given a string s and a character c, return a new list of integers of the same length as s where for each index i its value is set the closest distance of s[i...

Check Palindrome

less than 1 minute read

Given a string s, return whether it is a palindrome.

Balanced Brackets

less than 1 minute read

You’re given a string s consisting solely of "(" and ")". Return whether the parentheses are balanced.

ASCII String to Integer

less than 1 minute read

You are given a string s containing digits from "0" to "9" and lowercase alphabet characters. Return the sum of the numbers found in s.

Back to top ↑