TheRealSamuel/LeetCodeProblem
0572
1{2 "id": 3154,3 "name": "maximum_value_of_an_ordered_triplet_i",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/maximum-value-of-an-ordered-triplet-i/",6 "date": "2023-09-24 00:00:00",7 "task_description": "You are given a **0-indexed** integer array `nums`. Return _**the maximum value over all triplets of indices**_ `(i, j, k)` _such that_ `i < j < k`. If all such triplets have a negative value, return `0`. The **value of a triplet of indices** `(i, j, k)` is equal to `(nums[i] - nums[j]) * nums[k]`. **Example 1:** ``` **Input:** nums = [12,6,1,2,7] **Output:** 77 **Explanation:** The value of the triplet (0, 2, 4) is (nums[0] - nums[2]) * nums[4] = 77. It can be shown that there are no ordered triplets of indices with a value greater than 77. ``` **Example 2:** ``` **Input:** nums = [1,10,3,4,19] **Output:** 133 **Explanation:** The value of the triplet (1, 2, 4) is (nums[1] - nums[2]) * nums[4] = 133. It can be shown that there are no ordered triplets of indices with a value greater than 133. ``` **Example 3:** ``` **Input:** nums = [1,2,3] **Output:** 0 **Explanation:** The only ordered triplet of indices (0, 1, 2) has a negative value of (nums[0] - nums[1]) * nums[2] = -3. Hence, the answer would be 0. ``` **Constraints:** `3 <= nums.length <= 100` `1 <= nums[i] <= 106`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [12,6,1,2,7]",12 "output": "77 "13 },14 {15 "label": "Example 2",16 "input": "nums = [1,10,3,4,19]",17 "output": "133 "18 },19 {20 "label": "Example 3",21 "input": "nums = [1,2,3]",22 "output": "0 "23 }24 ],25 "private_test_cases": [26 {27 "input": [28 716799,29 394368,30 463381,31 112838,32 809276,33 534608,34 753433,35 558522,36 788309,37 257919,38 983724,39 535545,40 140467,41 834724,42 443738,43 165316,44 441518,45 565731,46 312911,47 360720,48 8323,49 694834,50 597449,51 191644,52 233924,53 304218,54 89623,55 35824356 ],57 "output": 70388685606858 },59 {60 "input": [61 816954,62 956418,63 754073,64 170418,65 801656,66 346171,67 223826,68 332092,69 284452,70 713745,71 575365,72 634095,73 471765,74 272335,75 151511,76 68655,77 513002,78 48833,79 705000,80 921354,81 446828,82 272339,83 747162,84 410611,85 22834,86 207870,87 155139,88 578089,89 725394,90 952872,91 321836,92 410262,93 146309,94 844879,95 81858,96 340777,97 1735,98 631323,99 925339,100 737604,101 392472,102 597657,103 202375104 ],105 "output": 889586053248106 },107 {108 "input": [109 610138,110 983041,111 793156,112 484067,113 343408,114 526626,115 369039,116 809128,117 204874,118 965585,119 113583,120 960041,121 386545,122 18639,123 274656,124 859910,125 204475,126 281721,127 54254,128 261919,129 39061,130 242352,131 140202,132 496056,133 778180,134 236416,135 410101,136 609445,137 645990,138 891176,139 281095,140 66945,141 279512,142 83024,143 693309,144 885201,145 9304,146 860170,147 118952,148 245526,149 815204,150 375498,151 806487,152 567461,153 610149,154 493126,155 294919,156 815993,157 797578,158 470888,159 41414,160 459291,161 866105,162 747947,163 562644,164 385510,165 149987,166 319247,167 603599,168 572482,169 543675,170 55418,171 120319,172 732145,173 377810,174 782492,175 469685176 ],177 "output": 859451916752178 },179 {180 "input": [181 112774,182 480706,183 314193,184 874993,185 78576,186 889670,187 265715,188 897003,189 785401,190 336999,191 391084,192 710406,193 978927,194 952230,195 71519,196 815260197 ],198 "output": 779634104559199 },200 {201 "input": [202 616516,203 685863,204 579443,205 242768,206 92176,207 725624,208 129583,209 826288,210 156183,211 330334,212 286067,213 289925,214 633929,215 933730,216 73490,217 244505,218 275686,219 90554,220 660545,221 598250,222 500836,223 135771,224 111743,225 503226226 ],227 "output": 625697141650228 }229 ],230 "haskell_template": "maximumTripletValue :: [Int] -> Int\nmaximumTripletValue nums ",231 "ocaml_template": "let maximumTripletValue (nums: int list) : int = ",232 "scala_template": "def maximumTripletValue(nums: List[Int]): Int = { \n \n}",233 "java_template": "class Solution {\n public long maximumTripletValue(int[] nums) {\n \n }\n}",234 "python_template": "class Solution(object):\n def maximumTripletValue(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "235}