help to optimize code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

help to optimize code

Hello All, Below is my code: https://code.sololearn.com/ci4Oi24Lq3xb Request your view on the same in terms of robustness and optimization. Thanks a lot for your input in advance...!

8th Jun 2020, 9:25 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Answers
0
No sorting required, do it in one pass, use appropriate data structure. Not sure if your code is correct either, haven’t really checked it
8th Jun 2020, 6:29 PM
Bobby Fischer
Bobby Fischer - avatar
0
Hi Bobby Fischer , I also thought about sorting issue.... I could not decide as map don't allow duplicate entry but it does sort while inserting... So I decided to go with multimap but again it would have duplicates and will have to go with count of each character to process... Am I still missing something else ?
8th Jun 2020, 8:09 PM
Ketan Lalcheta
Ketan Lalcheta - avatar