Tag: string algorithm
Given an array of characters, compress it in-place. The length after compression must always be smaller than or equal to the original array. Every element of the array should …
Given an encoded string, return it’s decoded string. The encoding rule is: k, where the encoded_string inside the square brackets is being repeated exactly k times. Note that k …
Given a string s and a non-empty string p, find all the start indices of p’s anagrams in s. Strings consists of lowercase English letters only and the length …
Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Input: haystack = “hello”, needle …
Given a non-empty string s and an abbreviation abbr, return whether the string matches with the given abbreviation. A string such as “word” contains only the following valid abbreviations: …