We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Non-Divisible Subset
Non-Divisible Subset
Sort by
recency
|
805 Discussions
|
Please Login in order to post a comment
I think test case 6 is incorrect. Given: n=5 k=1 s = [1 2 3 4 5] The "correct" output is 1 but all whole numbers are divisible by 1. Shouldn't the actual answer be 0 since a subset of size zero has no elements divisible by k?
Maximum size of subarray that satisfy the conditions is 1 because : it is the minimum possible subset of any array & (1+2) / 1, (1+3) / 1, (1+4) / 1, (1+5) / 1 ..... are all factors of 1.
I implemented algorithm in Java , and after testing , I found that in Test Case 5 , the expected result is 50 , but my actual calculation is 45 , Has anyone encountered this issue?
I know the issue is on my side , Please , could someone help me check where the problem is in my Code ,
The following is my code ...
I implemented algorithm in Java , and after testing , I found that in Test Case 5 , the expected result is 50 , but my actual calculation is 45 , Has anyone encountered this issue?
I know the issue is on my side , Please , could someone help me check where the problem is in my Code ,
The following is my code ...
this is very dificult if you dont do a little search for the algorithm
Here is a simple and effective code