Very easy if title is "possible values of given expression" ;)


  • 1
    V

    This problem need not to deal with parenthesis placement literally !!


  • 0
    K

    @vishal51 It does, if the title is "possible values of given expression", then input "23-45" will have answer [-34, -14, -10, 10], however, the actual answer is
    (2*(3-(45))) = -34
    ((2
    3)-(45)) = -14
    ((2
    (3-4))5) = -10
    (2
    ((3-4)5)) = -10
    (((2
    3)-4)*5) = 10
    Therefore, [-34, -14, -10, -10, 10]

    The input "4115" will have answer [60].
    However, the actual answer is
    (41)15 = 60
    4
    (1
    15) = 60
    Therefor, [60,60]


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.