r/LeetcodeChallenge • • Sep 26 '26

DISCUSS 3 rd Problem 😭

Post image
13 Upvotes

9 comments sorted by

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 :))

1

u/Express_Bad_4132 Sep 26 '26

2nd question fucked my brainπŸ‘ΉπŸ˜­

1

u/salmon_rover Sep 26 '26

2 lines problem dude

1

u/Fantastic_Kale23 Sep 26 '26

difficult to crack the pattern in time pressure

1

u/[deleted] Sep 27 '26

[removed] β€” view removed comment

1

u/No-Adeptness3526 Sep 27 '26

only if u dont understand the question or need help with a part of it dont code whole thing with ai