Created
July 11, 2021 14:36
-
-
Save aashish-chaubey/51aa70a61932739e03311e239e3eaf1b to your computer and use it in GitHub Desktop.
Task of Pairing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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
can you give full program