Skip to content

Commit 627b02e

Browse files
committed
week4day2
1 parent bfde942 commit 627b02e

4 files changed

Lines changed: 55 additions & 1 deletion

File tree

Week2-checkpoint.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"\"\"\"\n",
2020
"\n",
2121
"\n",
22-
"Daily check in 2"
22+
"Daily check in 3"
2323
]
2424
}
2525
],

Week4/.ipynb_checkpoints/Arrays-checkpoint.ipynb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,29 @@
3030
" dic[i] = 1\n",
3131
" return count "
3232
]
33+
},
34+
{
35+
"cell_type": "code",
36+
"execution_count": null,
37+
"id": "4b37d900",
38+
"metadata": {},
39+
"outputs": [],
40+
"source": [
41+
"\"\"\"\n",
42+
"The product difference between two pairs (a, b) and (c, d) is defined as (a * b) - (c * d).\n",
43+
"\n",
44+
"For example, the product difference between (5, 6) and (2, 7) is (5 * 6) - (2 * 7) = 16.\n",
45+
"Given an integer array nums, choose four distinct indices w, x, y, and z such that the product difference between pairs (nums[w], nums[x]) and (nums[y], nums[z]) is maximized.\n",
46+
"\n",
47+
"Return the maximum such product difference.\n",
48+
"\"\"\"\n",
49+
"\n",
50+
"class Solution:\n",
51+
" def maxProductDifference(self, nums: List[int]) -> int:\n",
52+
" #nums1 = list(set(nums))\n",
53+
" nums.sort()\n",
54+
" return (nums[-1]*nums[-2])-(nums[0]*nums[1])"
55+
]
3356
}
3457
],
3558
"metadata": {

Week4/Arrays.ipynb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,29 @@
3030
" dic[i] = 1\n",
3131
" return count "
3232
]
33+
},
34+
{
35+
"cell_type": "code",
36+
"execution_count": null,
37+
"id": "4b37d900",
38+
"metadata": {},
39+
"outputs": [],
40+
"source": [
41+
"\"\"\"\n",
42+
"The product difference between two pairs (a, b) and (c, d) is defined as (a * b) - (c * d).\n",
43+
"\n",
44+
"For example, the product difference between (5, 6) and (2, 7) is (5 * 6) - (2 * 7) = 16.\n",
45+
"Given an integer array nums, choose four distinct indices w, x, y, and z such that the product difference between pairs (nums[w], nums[x]) and (nums[y], nums[z]) is maximized.\n",
46+
"\n",
47+
"Return the maximum such product difference.\n",
48+
"\"\"\"\n",
49+
"\n",
50+
"class Solution:\n",
51+
" def maxProductDifference(self, nums: List[int]) -> int:\n",
52+
" #nums1 = list(set(nums))\n",
53+
" nums.sort()\n",
54+
" return (nums[-1]*nums[-2])-(nums[0]*nums[1])"
55+
]
3356
}
3457
],
3558
"metadata": {

week3-checkpoint.ipynb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,14 @@
209209
" str1 += dic[i]\n",
210210
" return str1 "
211211
]
212+
},
213+
{
214+
"cell_type": "code",
215+
"execution_count": null,
216+
"id": "0d80a2e1",
217+
"metadata": {},
218+
"outputs": [],
219+
"source": []
212220
}
213221
],
214222
"metadata": {

0 commit comments

Comments
 (0)