×

# DSORT - Editorial

Author: Shivam Pawase
Tester: Devansh Solanki
Editorialist: Sangram Desai

Easy

# PREREQUISITES:

Strings, Sorting.

# PROBLEM:

Given n integers, you have to print the numbers in descending order.

# EXPLANATION:

Simply sorting the numbers won't work as no of digits of a number can be upto 105 and max value of long long integer has only approximately 20 digits.

So you have to take input as string for every number and sort entire list first by length of numbers(as in string comparisons "200" is smaller than "50" since 2 < 5 as per ASCII) and if the length is same then that could be simply done by string sorting.

# AUTHOR'S AND TESTER'S SOLUTIONS:

Author's solution can be found here.
Tester's solution can be found here.

This question is marked "community wiki".

545
accept rate: 16%

19.6k349497539

 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×15,182
×3,673
×770
×38