You are given an integer num, and you can swap two digits at most once to get the largest possible number. Return the maximum number that can be obtained after performing the swap.
You are in a room with n bulbs, all initially turned on. There are four buttons on the wall, each with a different functionality: flip all bulbs, flip even-numbered bulbs, flip odd-numbered bulbs, and flip bulbs with labels j = 3k + 1. You need to make exactly presses presses. For each press, you can choose any button. Return the number of distinct possible configurations of the bulbs after performing all the presses.
Given a string consisting of ‘(’, ‘)’, and ‘’, determine if the string is valid according to the following rules. ‘’ can be treated as a left parenthesis, a right parenthesis, or an empty string.