PLMU : dec long challenge 2019 video editorial

PLMU video editorial is available.

video link : PLMU
Solution link : PLMU (Solution)

In this video we are to solve the Addition problem from codechef.
The problem requires basic knowledge of

  1. Simple Maths

if you find this video helpful leave a like at codechef article here.
likes on codechef article would make me feel better than the youtube like.

Thank you
CodeNCdode

2 Likes

in PLMU just count how many zero( 0 ) and one’ s ( 1 )are present
bcz only 0+0 == 0 * 0 and 2+2 == 2 * 2

t=int(input ())
for _ in range(t):
    n=int(input())
    ls=list(map(int,input().split(' ')))
    o=0
    tw=0
    for i in range(0,n):
        if(ls[i]==0):
            o+=1
        if(ls[i]==2):
            tw+=1
    print(((o*(o-1))//2)+((tw*(tw-1))//2))

yes that’s the approach to solve it

1 Like

yeahh man i did the same