Skip to main content
763, Partition Labels

I Problem

You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part.

Note that the partition is done so that after concatenating all the parts in order, the resultant string should be s.


MikeAbout 1 mingreedymediumgreedytwo pointershash tablestring
93, Restore IP Addresses

I Problem

A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclusive) and cannot have leading zeros.

  • For example, "0.1.2.201" and "192.168.1.1" are valid IP addresses, but "0.011.255.245", "192.168.1.312" and "192.168@1.1" are invalid IP addresses.

MikeAbout 1 minbacktrackingmediumstringbacktracking
131, Palindrome Partitioning

I Problem

Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s.

Example 1
Input: s = "aab"
Output: [["a", "a", "b"],["aa", "b"]]


MikeAbout 2 minbacktrackingmediumstringdynamic programmingbacktracking
17, Letter Combinations of a Phone Number

I Problem

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.

A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.


MikeAbout 1 minbacktrackingmediumhash tablestringbacktracking
257, Binary Tree Paths

I Problem

Given the root of a binary tree, return all root-to-leaf paths in any order.

A leaf is a node with no children.

Example 1

Input: root = [1, 2, 3, null, 5]
Output: ["1->2->5", "1->3"]


MikeAbout 3 minbinary treeeasystringbacktrackingdepth first searchbinary tree
1047, Remove All Adjacent Duplicates In String

I Problem

You are given a string s consisting of lowercase English letters. A duplicate removal consists of choosing two adjacent and equal letters and removing them.

We repeatedly make duplicate removals on s until we no longer can.


MikeAbout 1 minstack/queueeasystringstack
20, Valid Parentheses

I Problem

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

An input string is valid if:

  1. Open brackets must be closed by the same type of brackets.
  2. Open brackets must be closed in the correct order.
  3. Every close bracket has a corresponding open bracket of the same type.

MikeAbout 1 minstack/queueeasystringstack
459, Repeated Substring Pattern

I Problem

Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.

Example 1
Input: s = "abab"
Output: true
Explanation: It is the substring "ab" twice.


MikeAbout 1 minstringeasystringstring matching
28, Find the Index of the First Occurrence in a String

I Problem

Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

Example 1
Input: haystack = "sadbutsad", needle = "sad"
Output: 0
Explanation: "sad" occurs at index 0 and 6. The first occurrence is at index 0, so we return 0.


MikeAbout 2 minstringeasystringstring matchingtwo pointers
KamaCoder-55, Right-Rotated String

I Problem

The right rotation operation of a string is to transfer several characters at the end of the string to the front of the string. Given a string s and a positive integer k, please write a function to move the following k characters in the string to the front of the string, achieving the right rotation operation of the string.


MikeAbout 2 minstringeasystring
2
3