Java BigDecimal

  • + 3 comments

    OMG, my first solution was ridiculous! :-D I used one additional array to store BigDecimals and a map to store BigDecimals as keys and lists of strings as values. It worked, but solution with comparator is great!

    	Arrays.sort(s, 0, n, (o1, o2) -> {
                BigDecimal b1 = new BigDecimal(o1);
                BigDecimal b2 = new BigDecimal(o2);
                return b2.compareTo(b1);
            });