2657. Find the Prefix Common Array of Two Arrays
You are given two 0-indexed integerpermutations A and B of length n. A prefix common array of A and B is an array C such that C[i] is equal to the count of numbers that are present […]
You are given two 0-indexed integerpermutations A and B of length n. A prefix common array of A and B is an array C such that C[i] is equal to the count of numbers that are present […]
You are given a string s. You can perform the following process on s any number of times: Choose an index i in the string such
A parentheses string is a non-empty string consisting only of ‘(‘ and ‘)’. It is valid if any of the following conditions is true: It is (). It can
You are given an array of strings words and a string pref. Return the number of strings in words that contain pref as a prefix. A prefix of a string s is any
You are given a 0-indexed string array words. Let’s define a boolean function isPrefixAndSuffix that takes two strings, str1 and str2: isPrefixAndSuffix(str1, str2) returns true if str1 is both a prefix and a suffix of of str2, and false otherwise. For
Given an array of string words, return all strings in words that is a substring of another word. You can return the answer in any order. A substring is
You have n boxes. You are given a binary string boxes of length n, where boxes[i] is ‘0’ if the ith box is empty, and ‘1’ if it contains one ball. In one operation, you can
You are given a string s of lowercase English letters and a 2D integer array shifts where shifts[i] = [starti, endi, directioni]. For every i, shift the characters
Given a string s, return the number of unique palindromes of length three that are a subsequence of s. Note that even if there are multiple ways
You are given a 0-indexed integer array nums of length n. nums contains a valid split at index i if the following are true: The sum of the first i +
You are given a 0-indexed array of strings words and a 2D array of integers queries. Each query queries[i] = [li, ri] asks us to find the
Given a string s of zeros and ones, return the maximum score after splitting the string into two non-empty substrings (i.e. left substring and right substring). The score after splitting a