Question 1: Minimum Segments with No Repeated Characters
Given a string s, you need to perform the following operation exactly once, then compute the minimum number of non-overlapping, non-empty substrings with no repeated characters that the string can be split into:
- Choose any lowercase English letter, and delete every occurrence of it from the string.
Constraints:
- 1 <= |s| <= 2 * 10^5
- String s consists only of lowercase English letters.
Question 2: Minimum Operations to Reduce N to Zero
Given a positive integer n, in one operation you can add or subtract 2^i (where i >= 0) to/from the current value. Find the minimum number of operations needed to reduce n to 0.
Constraints:
- 1 <= n < 2^60
Discussion
Loading comments…