Check if there is a subarray with sum divisible by 3.

Revision en1, by potter, 2022-01-03 17:03:55

[problem:https://codeforces.net/contest/1176/problem/B]

So I came across this problem and I would like to implement and idea that after removing values that are directly divisible by 3 and the pairs that add upto sum (divisible by 3), the rem. ones may have some kind of combination of elements with sum adding upto 3

Example:

arr = [1,1,1,1,1,2,2]

after two operations , pairs gets out [1,2],[1,2] with sum(%3==0)

rem = [1,1,1]

Now, how to know that rem array may have some combinations sum divisible by 3?

Tags #solution, #dp, #what to use

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English potter 2022-01-03 17:06:01 13
en2 English potter 2022-01-03 17:04:30 19
en1 English potter 2022-01-03 17:03:55 598 Initial revision (published)