Frequency of digits in an array and store elements in new array in a sorted order such a way that more frequent one comes first and least frequent one at the end.

AnswerBot
1y

Sort array of strings based on frequency of digits in each element.

  • Create a dictionary to store frequency of digits in each element.

  • Sort the array based on the frequency of digits using the dictionary...read more

Anonymous
1y
arr=list(map(int,input().split())) freq={} for elem in arr: if elem in freq: freq[elem]+=1 else: freq[elem]=0 freq=sorted(freq.items(),key=lambda x:x[1],reverse=True) arr.clear() for key,items in freq...read more
Help your peers!
Add answer anonymously...
Amadeus Senior Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter