Shortest String
Given a string s consisting only of "1"s and "0"s, you can delete any two adjacent letters if they are different.
Given a string s consisting only of "1"s and "0"s, you can delete any two adjacent letters if they are different.
You are given a list of integers nums of length n. Return whether you can make a list [1, 2, ..., n] or [n, n - 1, ..., 1] by shifting nums to the right any ...
Implement a set data structure with the following methods:
Given a list of strings sentence where each sentence[i] is a string with single character, reverse the order of the words in the sentence.
You are given a list of integers items and an integer n. A salesperson has items in a bag with random IDs. The salesperson can remove as many as n items from...
Given a binary tree root, return the depth of the second deepest leaf. Note that if there are multiple deepest leaves, the second deepest leaf is the next hi...
Consider a complete binary tree of n nodes whose values are 1 to n. The root has value of 1, its left child is 2 and its right child is 3. In general, nodes’...
Given a binary search tree root and an integer val, determine whether val is in the tree.
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.
Given a string s, consisting of digits and lowercase alphabet characters, that’s a run-length encoded string, return its decoded version.
Given a run-length encoded lowercase alphabet string s, implement an iterator which is the decoded version of s:
Given two alphabet (can be lower and/or uppercase) strings s0 and s1, determine if one is a rotation of the other.