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.
Sure thing. Basically I'm unpacking the list comprehension and printing each element of it.
The list is built of elements of (len(list(c)), int(k)). len(list(c)) is simply the number of occurences of a character c returned by the groupby function. k is just the key value, the character itself.
Hope this helps, let me know if you have any other questions about anything specific.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Compress the String!
You are viewing a single comment's thread. Return to all comments →
Sure thing. Basically I'm unpacking the list comprehension and printing each element of it.
The list is built of elements of (len(list(c)), int(k)). len(list(c)) is simply the number of occurences of a character c returned by the groupby function. k is just the key value, the character itself.
Hope this helps, let me know if you have any other questions about anything specific.