Sort by

recency

|

942 Discussions

|

  • + 0 comments

    Big Sorting always brings a fresh burst of youthful energy! It's amazing to see how they handle every task with such enthusiasm and creativity. Makes sorting feel like a fun challenge, doesn't it? https://youthandearth.com/

  • + 0 comments

    Java soluation:

    public static List<String> bigSorting(List<String> unsorted) {
     
        Collections.sort(unsorted , new Comparator<String>() {
            @Override
            public int compare(String s1, String s2) {
                int length = s1.length() - s2.length();
                if(length != 0)
                   return length;
                    
                BigInteger n1 = new BigInteger(s1);
                BigInteger n2 = new BigInteger(s2);
                return n1.compareTo(n2);
                }
        });
        return unsorted; 
       }
    
  • + 0 comments

    There seems to be an issue with the test case. In this code, the task is to sort an array. However, the test case provided appears to be unrelated to this question and doesn't match the expected input-output format.

    Input (stdin) 7693 20 6 5 59 22 8 7 18 81 48 32 7 7 93 2 83 45 57 2{-truncated-} Expected Output 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1{-truncated-}

  • + 0 comments

    Here is my c++ solution, you can watch the explanation here : https://youtu.be/GAvltofMdYc

    vector<string> bigSorting(vector<string> u) {
        sort(u.begin(), u.end(), [](string l, string r){
            if(l.size() == r.size()) return l < r;
            return l.size() < r.size();
        });
        return u;
    }
    
  • + 0 comments

    Java 15

        public static List<String> bigSorting(List<String> unsorted) {
            unsorted.sort((a, b) -> {
                if (a.length() != b.length()) {
                    return Integer.compare(a.length(), b.length());
                }
                return a.compareTo(b);
            });
            return unsorted;
        }