Skip to content

Commit 2a7a28a

Browse files
refactor 368
1 parent 6adfddb commit 2a7a28a

File tree

1 file changed

+3
-19
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+3
-19
lines changed

src/main/java/com/fishercoder/solutions/_368.java

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,12 @@
44
import java.util.Arrays;
55
import java.util.List;
66

7-
/**
8-
* 368. Largest Divisible Subset
9-
*
10-
* Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0.
11-
12-
If there are multiple solutions, return any subset is fine.
13-
14-
Example 1:
15-
16-
nums: [1,2,3]
17-
18-
Result: [1,2] (of course, [1,3] will also be ok)
19-
Example 2:
20-
21-
nums: [1,2,4,8]
22-
23-
Result: [1,2,4,8]
24-
*/
257
public class _368 {
268

279
public static class Solution1 {
28-
/** Credit: https://discuss.leetcode.com/topic/49652/classic-dp-solution-similar-to-lis-o-n-2 */
10+
/**
11+
* Credit: https://discuss.leetcode.com/topic/49652/classic-dp-solution-similar-to-lis-o-n-2
12+
*/
2913
public List<Integer> largestDivisibleSubset(int[] nums) {
3014
int len = nums.length;
3115
int[] count = new int[len];

0 commit comments

Comments
 (0)