# Is this question broken? aka ill-posed

• Update: The question has now been updated and is correct.

I have a major problem with this question it says `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.`

The key word here is every, lets look at one of the examples

``````input is nums = [1,2,3]

then the result is [1,2]
``````

but in the question is say that for every pair in our solution we should have Si % Sj = 0. So lets look at every pair we have the first pair (2, 1) and we have 2%1 = 0, so that holds. Now lets look at the other pair (1,2) 1%2 = 1 this is not zero hence [1,2] cannot be the solution.

If we require every pair so that Si % Sj = 0 then your subset will be a set of one item since we require both that Sj% Si = 0 and Si % Sj = 0 which forces that Si = Sj.

So please fix the requirements of the question to reflect what the author intended.

• actually the condition should be S_i % S_j = 0 or S_j % S_i = 0. sorry for inconvenience.

• Thanks for clearing that up

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.