Could we use smaller Trinocular operator

for example:

dp[i-1][j] > dp[i][j-1] ? dp[i-1][j] : dp[i][j-1] 

It's so long, and hard to understand .
could we use a shorter way to do this ?
such as

dp[i-1][j] > dp[i][j-1] ? $0 : $1
1 Like
1 Like

You mean

max(dp[i-1][j], dp[i][j-1])

?

3 Likes

yeah, I made a mistake.
It can't be implement.
because it's bool ? a : b
can't get dp[i-1][j]

It's helpfull. thanks