Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit08c3e38

Browse files
refactor 1196
1 parentd581569 commit08c3e38

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

‎src/main/java/com/fishercoder/solutions/_1196.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,6 @@
22

33
importjava.util.Arrays;
44

5-
/**
6-
* 1196. How Many Apples Can You Put into the Basket
7-
*
8-
* You have some apples, where arr[i] is the weight of the i-th apple. You also have a basket that can carry up to 5000 units of weight.
9-
* Return the maximum number of apples you can put in the basket.
10-
*
11-
* Example 1:
12-
* Input: arr = [100,200,150,1000]
13-
* Output: 4
14-
* Explanation: All 4 apples can be carried by the basket since their sum of weights is 1450.
15-
*
16-
* Example 2:
17-
* Input: arr = [900,950,800,1000,700,800]
18-
* Output: 5
19-
* Explanation: The sum of weights of the 6 apples exceeds 5000 so we choose any 5 of them.
20-
*
21-
* Constraints:
22-
* 1 <= arr.length <= 10^3
23-
* 1 <= arr[i] <= 10^3
24-
* */
255
publicclass_1196 {
266
publicstaticclassSolution1 {
277
publicintmaxNumberOfApples(int[]arr) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp