Skip to content
the poor coder

Home / Topics / #string

#string

40 posts · page 2 of 2
2021

Leetcode - Find and Replace Pattern Solution

You have a list of words and a pattern, and you want to know which words in words matches the pattern. A word matches the pattern if there exists a permutation of letters p so that after replacing every letter x in the…

leetcodestring1 min read
2021

Leetcode - Buddy Strings Solution

Given two strings a and b, return true if you can swap two letters in a so the result is equal to b, otherwise, return false. Swapping letters is defined as taking two indices i and j (0-indexed) such that i != j and…

leetcodestring2 min read
2021

Leetcode - Goat Latin Solution

A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to convert the sentence to "Goat Latin" (a made-up language similar to Pig Latin.)…

leetcodestring1 min read
2021

Leetcode - Most Common Word Solution

Given a string paragraph and a string array of the banned words banned, return the most frequent word that is not banned. It is guaranteed there is at least one word that is not banned, and that the answer is unique…

leetcodestring2 min read
2021

Leetcode - Unique Morse Code Words Solution

International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on. For convenience, the full…

leetcodestring1 min read
2021

Leetcode - Custom Sort String Solution

S and T are strings composed of lowercase letters. In S, no letter occurs more than once. S was sorted in some custom order previously. We want to permute the characters of T so that they match the order that S was…

leetcodestring1 min read
2021

Leetcode - Detect Capital Solution

We define the usage of capitals in a word to be right when one of the following cases holds: All letters in this word are capitals, like "USA". All letters in this word are not capitals, like "leetcode". Only the first…

leetcodestring1 min read
2021

Leetcode - Ransom Note Solution

Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines ; otherwise, it will…

leetcodestring1 min read
2021

Leetcode - Group Anagrams Solution

Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all…

2021

Leetcode - Multiply Strings Solution

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Note: You must not use any built-in BigInteger library or convert the inputs to…

2021

Leetcode - Valid Parentheses Solution

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open…

2021

Leetcode - Longest Common Prefix Solution

Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Example 2: Constraints: 0 <= strs.length <= 200 0 <=…

leetcodestring1 min read
2021

Leetcode - ZigZag Conversion Solution

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) And then read line by line: "PAHNAPLSIIGYIR"…

leetcodestring1 min read
ESC