Skip to content

Instantly share code, notes, and snippets.

@aashish-chaubey
Created July 11, 2021 14:36
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aashish-chaubey/51aa70a61932739e03311e239e3eaf1b to your computer and use it in GitHub Desktop.
Save aashish-chaubey/51aa70a61932739e03311e239e3eaf1b to your computer and use it in GitHub Desktop.
Task of Pairing
def taskOfPairing(freq):
count = 0
marker = False
for i in freq:
if i != 0:
count += i // 2
if i % 2 != 0 and marker:
count += 1
marker = False
elif i % 2 != 0:
marker = True
else:
marker = False
return count
@aashish-chaubey
Copy link
Author

aashish-chaubey commented Nov 23, 2021

Buddy, 12/15 testcases don't pass with your solution.

@therajdeepbiswas Can you please paste some of the test cases here? Let me check and fix it!

@vishalm30
Copy link

Buddy, 12/15 testcases don't pass with your solution.

Change last marker to False
Then all your test cases will run

@ramakrishna1607
Copy link

thanks a lot, bro, but change your code, there is a bug on top where you need to change marker=False

@Priyanshu581
Copy link

can you give full program

@GowthamPonraj
Copy link

i wrote the same code ... i only passed 3/15 cases ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment