DatasetRepo's picture
Upload folder using huggingface_hub (#1)
0a33073 verified
{
"id": 2756,
"name": "buy_two_chocolates",
"difficulty": "Easy",
"link": "https://leetcode.com/problems/buy-two-chocolates/",
"date": "2023-05-13 00:00:00",
"task_description": "You are given an integer array `prices` representing the prices of various chocolates in a store. You are also given a single integer `money`, which represents your initial amount of money. You must buy **exactly** two chocolates in such a way that you still have some **non-negative** leftover money. You would like to minimize the sum of the prices of the two chocolates you buy. Return _the amount of money you will have leftover after buying the two chocolates_. If there is no way for you to buy two chocolates without ending up in debt, return `money`. Note that the leftover must be non-negative. **Example 1:** ``` **Input:** prices = [1,2,2], money = 3 **Output:** 0 **Explanation:** Purchase the chocolates priced at 1 and 2 units respectively. You will have 3 - 3 = 0 units of money afterwards. Thus, we return 0. ``` **Example 2:** ``` **Input:** prices = [3,2,3], money = 3 **Output:** 3 **Explanation:** You cannot buy 2 chocolates without going in debt, so we return 3. ``` **Constraints:** `2 <= prices.length <= 50` `1 <= prices[i] <= 100` `1 <= money <= 100`",
"public_test_cases": [
{
"label": "Example 1",
"input": "prices = [1,2,2], money = 3",
"output": "0 "
},
{
"label": "Example 2",
"input": "prices = [3,2,3], money = 3",
"output": "3 "
}
],
"private_test_cases": [
{
"input": [
[
61,
75,
67
],
77
],
"output": 77
},
{
"input": [
[
81,
8,
10,
44,
100,
38,
7,
47
],
64
],
"output": 49
},
{
"input": [
[
19,
6,
24,
7,
94,
40,
97,
60,
82,
62,
53,
12,
8,
56,
42,
48,
85,
76,
34,
29,
57,
28,
17,
31,
36,
3,
90,
92,
78,
64,
80,
84,
50,
39,
73,
86,
41,
11,
95,
88,
37,
1,
27
],
2
],
"output": 2
},
{
"input": [
[
60,
32,
4,
35,
36,
45
],
38
],
"output": 2
},
{
"input": [
[
51,
80,
78,
44,
72,
50,
74,
81,
30,
63,
58,
43,
16,
65,
39,
66,
96,
42,
31,
17,
15,
92,
25,
75,
6,
33,
45,
14
],
7
],
"output": 7
},
{
"input": [
[
14,
55,
19,
73,
75,
69,
88,
18,
28,
22,
2,
72,
29,
5,
17,
64,
68,
60,
3,
96,
95,
47,
7,
53,
78,
70,
21,
84,
46,
27,
38
],
37
],
"output": 32
},
{
"input": [
[
51,
50,
22,
39,
21,
23,
99,
97,
66,
41,
3,
79,
89,
91,
31,
35,
14,
5,
11,
71,
38,
82,
7,
84,
48,
30,
28,
90,
58,
60,
94,
53,
9,
87,
47,
72,
74,
75,
25,
43,
4,
57,
86
],
41
],
"output": 34
}
],
"haskell_template": "buyChoco :: [Int] -> Int -> Int\nbuyChoco prices money ",
"ocaml_template": "let buyChoco (prices: int list) (money: int) : int = ",
"scala_template": "def buyChoco(prices: List[Int],money: Int): Int = { \n \n}",
"java_template": "class Solution {\n public int buyChoco(int[] prices, int money) {\n \n }\n}",
"python_template": "class Solution(object):\n def buyChoco(self, prices, money):\n \"\"\"\n :type prices: List[int]\n :type money: int\n :rtype: int\n \"\"\"\n "
}