Skip to content
This repository was archived by the owner on Sep 22, 2021. It is now read-only.
This repository was archived by the owner on Sep 22, 2021. It is now read-only.

0368 - Largest Divisible Subset #548

@sailok

Description

@sailok

Description of the Problem

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.

If there are multiple solutions, return any subset is fine.

Code

class Solution:
    def largestDivisibleSubset(self, nums: List[int]) -> List[int]:
        

Link To The LeetCode Problem

Largest Divisible Subset

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions