Java QuickSelect using recursion and iterative loop
```\nclass Solution {\n    public String kthLargestNumber(String[] nums, int k) {\n        int len = nums.length;\n        //return quickselectRecursion(nums,0,
```\nclass Solution {\n    public String kthLargestNumber(String[] nums, int k) {\n        int len = nums.length;\n        //return quickselectRecursion(nums,0,len-1, len-k);\n        return quickselectIterative(nums,k);\n    }\n\n    public String quickselectIterative(String[] nums, int k) {\n        \n        int kSmallestPos = nums.length  - k;\n        int[] pivotIdx = new int[]{0,nums.length -1};\n        int left = pivotIdx[0];\n        int right = pivotIdx[1];\n\n        while(true) {\n            if (left >= right)\n                return nums[left];\n            \n            pivotIdx = partition(nums, left, right);\n            \n            if (kSmallestPos < pivotIdx[0]) {\n                right = pivotIdx[0] - 1;\n            } else if (kSmallestPos > pivotIdx[1]) {\n                left = pivotIdx[1] + 1;\n            } else {\n                break;\n            }\n        }\n        return nums[kSmallestPos];\n    }\n\n    public String quickselectRecursion(String[] nums, int start, int end, int k) {\n        \n        if (start == end)\n            return nums[start];\n\n        int[] pivotIdx = partition(nums,start,end);  \n        \n        if (k < pivotIdx[0]) \n            return quickselectRecursion(nums, start, pivotIdx[0] - 1, k);\n        if (k > pivotIdx[1]) \n            return quickselectRecursion(nums, pivotIdx[1] + 1, end, k);\n        \n        return nums[k];\n    }\n\n    // lomuto\'s 3 way partition\n    // select a random pivot.\n    // transfer the pivot to start.\n    private int[] partition (String[] nums, int start, int end){\n        \n        int left = start;\n        int right = end;\n        int mid = start+1;\n\n        Random rand = new Random();\n        int pivotPos = rand.nextInt(end-start+1)+start;\n        String pivotValue = nums[pivotPos];\n        \n        swap(nums, pivotPos, left);\n        left++;\n        \n        while (mid <= right) {\n            int c = compare(nums[mid], pivotValue);\n            if (c == 0) {\n                mid++;\n            } else {\n                if (c < 0) {\n                    swap(nums, mid++, left++);\n                } else {\n                    swap(nums, mid, right--);\n                }\n            }\n        }\n        \n        swap(nums, start, right);\n\n        // right will be the last pivot value. \n        // left will be first pivot value.\n        return new int[]{left,right};\n    }\n    \n    // helper func to do custom string compare\n    private int compare(String a, String b){\n       return (a.length() == b.length()) ? a.compareTo(b) : a.length() - b.length();\n    }\n    \n    //helper func to perform swap\n    private void swap (String[] nums, int l, int r){\n        String temp = nums[l];\n        nums[l] = nums[r];\n        nums[r] = temp;\n    }\n}\n\n\n
['Iterator', 'Java']