class Solution: def numSubarrayProductLessThanK(self, s): dic = collections.Counter(s).most_common() res = "" print(dic) # sorted(dic.items(), key=lambda x:x[1]) for c, v in dic: res += c*v return res
class Solution: def numSubarrayProductLessThanK(self, s): dic = collections.Counter(s).most_common() res = "" print(dic) # sorted(dic.items(), key=lambda x:x[1]) for c, v in dic: res += c*v return res