100% BEATS Java Solutions🔥|| Clean and easy to understand code|| look at once
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(nlogn)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int maxDistance(int[] nums1, int[] nums2) {\n        int diff = 0;\n        for(int i = 0;i<nums1.length;i++){\n            int start = i;\n            int end = nums2.length-1;\n            while(start <= end){\n                int mid = start+(end-start)/2;\n                if(nums1[i] <= nums2[mid]){\n                    diff = Math.max(diff, mid-i);\n                    start = mid+1;\n                }\n                else{\n                    end = mid-1;\n                }\n            }\n        }\n        return diff;\n    }\n}\n```\nplease upvote this for better solution of other questions![download.jfif](https://assets.leetcode.com/users/images/e6a821b5-0e5e-44f6-83bb-f4e3d79e9201_1679927094.6032372.jpeg)\n
['Two Pointers', 'Binary Search', 'Java']