Company Logo [HackerRank] | Python | Counter().most_common() | unpack operator | Interview
This video is about HackerRank problem Company Logo from the topic collections in Python. #HackerRank #Python #Interview Problem : https://www.hackerrank.com/challenges/most-commons/problem Problem Statement: A newly opened multinational brand has decided to base their company logo on the three most common characters in the company name. They are now trying out various combinations of company names and logos based on this condition. Given a string s, which is the company name in lowercase letters, your task is to find the top three most common characters in the string. Print the three most common characters along with their occurrence count. Sort in descending order of occurrence count. If the occurrence count is the same, sort the characters in alphabetical order. Sample Code: from collections import Counter if __name__ == '__main__': s=sorted(input()) z=Counter(s) # print(z) z=Counter(s).most_common(3) # print(z) for x in z: print(*x) Unpack operator https://docs.python.org/3/reference/expressions.html?highlight=list#expression-lists question(https://www.hackerrank.com/challenges/maximize-it/problem) For 1 : 1 Tutoring WhatsApp contact : 7278222619 mail: [email protected] You can support via UPI : sattujaiswal@okhdfcbank Follow me on: Whatsapp: https://chat.whatsapp.com/LNwHGukUizjJPAxK7ma8gs Facebook: https://www.facebook.com/coderscart/ Linkedin: https://www.linkedin.com/in/satyendra-jaiswal-903588a2/ Instagram: https://www.instagram.com/jaiswal_satyendra/
Download
0 formatsNo download links available.