1 % 5 = 1, I don't understand how you got 4 at minute 6:05 . Someone Please explain this to me.
@divyanshudwivedi25913 жыл бұрын
Great job!
@KindsonTheTechPro3 жыл бұрын
Thanks! And do remember to subscribe to get updated!
@phinguyen48233 жыл бұрын
if k - mod == 0: compl = 0 else: compl = k - mod WHAT? if mod == 0: compl = 0 else: compl = k - mod Should be this way instead :D
@KindsonTheTechPro3 жыл бұрын
You need three conditions: 1. If the complement exists, increment count 2. if the mod exists, increase modulus value by 1 3. Else, add the value to the hash table Sorry my explanation was not clear enough 😊
@sushantsomani2943 жыл бұрын
Yes correct....try input for {1,2,3,4,5} and k=2
@nemanja.tonic872 жыл бұрын
int compl = k - mod == 0 ? 0 : k - mod; isn't this the same as just writing int compl = k - mod; I have no idea how your code passes the testcases, but that line should say: int compl = mod == 0 ? 0 : k - mod;