06 Feb Java BigDecimal with Explanation
Hello Friends, How are you? Today I am going to solve the HackerRank Java BigDecimal Problem with a very easy explanation. This is the 24th problem of Java on HackerRank. In this article, you will get more than one approach to solve this problem. So let’s start- {tocify} $title={Table of Contents} Java’s BigDecimal class can handle arbitrary-precision signed decimal numbers. Let’s test your knowledge of them! Given an array, s, of n 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 .1 is printed as .1, and 0.1 is printed as 0.1. If two numbers represent numerically equivalent values (e.g.,.1 ☰ 0.1 ), 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 the array’s elements according to the instructions above. The first line consists of a single integer, n, denoting the number of integer strings. Each line i of the n subsequent lines contains a real number denoting the value of Si.
- 1
Sorry, the comment form is closed at this time.