Largest Number | String Sorting comparator | LeetCode 179 in java | Greedy DSA | Must do DSA MAANG
Code Thoughts Code Thoughts
1.3K subscribers
353 views
7

 Published On Sep 17, 2024

Question Link:- https://leetcode.com/problems/largest...

Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.

Since the result may be very large, so you need to return a string instead of an integer.


Time Complexity: O(n log n)
Auxiliary Space: O(N+s), where S is space complexity taken internally by sorting algorithm

my approach is simple, i am not only sorting only in descending order to the array strings but also taking care if they are making greatest valued combination by making the string concatenation for prefix and append case and finally returning the appended array string as an answer.

Usage Of Counting sort :-    • Maximum Total Importance of Roads |Co...  
DSA Algorithms :-
   • Topological sorting in Hindi | Topolo...  
Design HLD:-
   • Design E-commerce website | Design Am...  

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview #interviewtips
#interviewpreparation #interview_ds_algo #hinglish

show more

Share/Embed