HackerRank Python - Merge the Tools




Problem link- https://www.hackerrank.com/challenges/merge-the-tools/problem



  1. def merge_the_tools(string, k):
  2. # your code goes here
  3. temp = []
  4. len_temp = 0
  5. for item in string:
  6. len_temp += 1
  7. if item not in temp:
  8. temp.append(item)
  9. if len_temp == k:
  10. print (''.join(temp))
  11. temp = []
  12. len_temp = 0
  13. if __name__ == '__main__':
  14. string, k = input(), int(input())
  15. merge_the_tools(string, k)




codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube