I have an array of strings.
I have to sort them in descending order. If 2 string have same length then we don't change their order.
So i wrote this code [Function in line 13 do the works mentioned above]
But for this given case below
sj a sa df r e w f d s a v c x z sd fd
Output: fd sa df sd sj d z x c v a s f w e r a
Right Output: sj sa df sd fd a r e w f d s a v c x z
[Problem is causing when 2 string have same length. Then those are automatically sorted lexicographic way. How to prevent it?]
[If i replace return a.length() > b.length();
in line 15 with return a.length() >= b.length();
then the code is crashed]