We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
You look really close, you just need a little more speed. With these Python challenges, I've found that using a built-in function is always faster than anything I can hand code. A couple of notes:
line 6: Use raw_input because it returns a string already, no need to cast
line 6-8: You can get rid of lines 6 and 7 by replacing line 8's "in guyslist" with "list(raw_input())"
line 12: Using map() instead of another for loop will help a lot. E.g. "knowntopics = sum(map(max,guyslist[i],guyslist[j]))"
Happy coding!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
ACM ICPC Team
You are viewing a single comment's thread. Return to all comments →
You look really close, you just need a little more speed. With these Python challenges, I've found that using a built-in function is always faster than anything I can hand code. A couple of notes:
line 6: Use raw_input because it returns a string already, no need to cast
line 6-8: You can get rid of lines 6 and 7 by replacing line 8's "in guyslist" with "list(raw_input())"
line 12: Using map() instead of another for loop will help a lot. E.g. "knowntopics = sum(map(max,guyslist[i],guyslist[j]))"
Happy coding!