Showing 3 questions
Determine if a number is a 'happy number'. A happy number eventually reaches 1 when replaced by the sum of the squares of its digits, repeating the process until it does.
#1. Happy Number
Find the length of the longest valid (well-formed) parentheses substring within a string containing only '(' and ')' characters. A valid substring has correctly matched opening and closing parentheses.
#2. Longest Valid Parentheses
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. You need to implement a stack with an additional function to efficiently get the minimum value.
#3. Min Stack