I'm trying to solve the "Merge the tools" in python Hackerrank, my code satisfies the Sample Testcase but not the others. Can someone please help me figure out where I'm going wrong?
This is the link to the question: https://www.hackerrank.com/challenges/merge-the-tools/problem?isFullScreen=true
And this is what I've written within the function:
import textwrap
from collections import OrderedDict as od
def merge_the_tools(string, k):
# your code goes here
length = int(len(string)/k)
words = textwrap.wrap(string,length)
for i in words:
new_dict = od.fromkeys(i)
print("".join(new_dict))
Just a plain dictionary will suffice. You don't need to import anything