All Posts
Leetcode 2325: Decode the Message
Given a cipher key and a secret message, decode the message by replacing each letter with the corresponding letter in the alphabet based on the first appearance of each letter in the key. Spaces in the message remain unchanged.
Leetcode 2336: Smallest Number in Infinite Set
You have a set containing all positive integers starting from 1. You need to implement a class SmallestInfiniteSet that has the following methods:
- SmallestInfiniteSet() Initializes the set to contain all positive integers starting from 1.
- popSmallest() Removes and returns the smallest integer in the set.
- addBack(int num) Adds a positive integer num back into the set, if it’s not already present in the set.