Skip to content

Latest commit

 

History

History

Java BigDecimal

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Java HackerRank

Difficulty Max Score Success Ratio
Medium 20 94.78%

Java's BigDecimal class can handle arbitrary-precision signed decimal numbers. Let's test your knowledge of them!

Given an array, [SVG image] , of [SVG image] real number strings, sort them in descending order — but wait, there's more! Each number must be printed in the exact same format as it was read from stdin, meaning that [SVG image] is printed as [SVG image] , and [SVG image] is printed as [SVG image] . If two numbers represent numerically equivalent values (e.g., [SVG image] ), then they must be listed in the same order as they were received as input).

Complete the code in the unlocked section of the editor below. You must rearrange array [SVG image] 's elements according to the instructions above.

Input Format

The first line consists of a single integer, [SVG image] , denoting the number of integer strings.

Each line [SVG image] of the [SVG image] subsequent lines contains a real number denoting the value of [SVG image] .

Constraints

  • [SVG image]
  • Each [SVG image] has at most [SVG image] digits. Output Format

Locked stub code in the editor will print the contents of array [SVG image] to stdout. You are only responsible for reordering the array's elements.

Sample Input

9
-100
50
0
56.6
90
0.12
.12
02.34
000.000

Sample Output

90
56.6
50
02.34
0.12
.12
0
000.000
-100

💡 Hints

➡️ Approach

✅ Detailed Solution

View Solution : Java BigDecimal

Submissions Leaderboard Discussions Editorial
📝 My Submission 🏆 Track our position 🤔 Help from Community ✍️ Editorial