Algorithm · Visa · Medium
Given two non-negative integers, n and m, form the expression string n+m. Add parentheses so that the expression's value is as small as possible, then return the resulting parenthesized expression. The initial expression is guaranteed to be valid and contains no spaces. Example Input: n = 3, m = 2 Output: "(3+2)" Note Both n and m are non-negative integers. Each integer may contain at most 100 digits. The expression produced after adding parentheses must be valid. The inputs…
Checking your access…