알고리즘 48 - Expressions Matter

tamagoyakii·2021년 10월 17일
0

알고리즘

목록 보기
48/89

Q.

Given three integers a ,b ,c, return the largest number obtained after inserting the following operators and brackets: +, , ()
In other words , try every combination of a,b,c with [
+()] , and return the Maximum Obtained

A)

function expressionMatter(a, b, c) {
  return Math.max(a * (b + c), a * b * c, a + b * c, (a + b) * c, a + b + c)
}

0개의 댓글