-
Notifications
You must be signed in to change notification settings - Fork 382
Closed
Description
LeetCode Username
ayan_9819
Problem Number, Title, and Link
https://leetcode.com/problems/minimum-score-triangulation-of-polygon/submissions/1786535938
Bug Category
Problem examples
Bug Description
Bottom up approach
Language Used for Code
Java
Code used for Submit/Run operation
class Solution {
public int minScoreTriangulation(int[] values) {
int n = values.length;
int[][] dp = new int[n][n];
for (int i = n - 1; i >= 0; --i) {
for (int j = i + 1; j < n; ++j) {
for (int k = i + 1; k < j; ++k) {
dp[i][j] = Math.min(dp[i][j] == 0 ? Integer.MAX_VALUE : dp[i][j],
dp[i][k] + values[i] * values[k] * values[j] + dp[k][j]);
}
}
}
return dp[0][n - 1];
}
}Expected behavior
6 ms
Beats 9.29%
Screenshots
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels