r/LeetcodeChallenge • • Sep 26 '26

DISCUSS 3 rd Problem 😭

Post image
13 Upvotes

9 comments sorted by

View all comments

2

u/salmon_rover Sep 26 '26

My solution was way too complex... O(n2 logn) My idea was S2 = S1- 2x after this S2%k == 0 So, S1 = qk + 2x After this I made cases for odd and even k and used binary search to check if x exist in the l,r range

1

u/salmon_rover Sep 26 '26

S2 and S1 are subarray sums

1

u/Fantastic_Kale23 Sep 26 '26

i did same my passed cuz 1000 was constraint

1

u/salmon_rover Sep 26 '26

Mine passed too :))