hacker rank 25th problem solution(java big decimal)

25. JAVA BIG DECIMAL

Arrays.sort(s, new Comparator<String>() {
      @Override
      public int compare(String o1, String o2) {
    if (o1 == null || o2 == null) {
        return 0;
    }
    BigDecimal o1bd = new BigDecimal(o1);
    BigDecimal o2bd = new BigDecimal(o2);
    return o2bd.compareTo(o1bd);
      }
  });

Compiler Message
Success
Input (stdin)Download
9
-100
50
0
56.6
90
0.12
.12
02.34
000.000
{-truncated-}
Download to view the full testcase
Expected OutputDownload
90
56.6
50
02.34
0.12
.12
0
000.000
-100
{-truncated-}
Download to view the full testcase

Comments

Popular posts from this blog

Amazon Web Services

Google Code-In mentorship experience :)

Hacker Rank all java and python problem solutions