Can someone help me with this problem!!!pls!!!
My method:\n1. i found sum of each pair from i=0 to i<nums.length/2 i.e nums[i]+nums[nums.length-1-i];\n2. then for each calculated sum i check pairs from i=0 t
My method:\n1. i found sum of each pair from i=0 to i<nums.length/2 i.e nums[i]+nums[nums.length-1-i];\n2. then for each calculated sum i check pairs from i=0 to i<nums.length/2 i.e nums[i]+nums[nums.length-1-i];\n3. if this pair is equal to the calculated sum 0 modification is required so i go for next pair else i see whether it sum is greater or lesser than the calculated sum.\n4. if the sum is greater than calculated sum find the diffrence between sum and calculated sum, and subtract the diffrence from any one in the pair and see whether it lies between i<=limit which is 1 modification else move to another number in the pair and see whether it lies between i<=limit which is 1 modification else i need to modify both the numbers in the pair so 2 modification.\n5. if the sum is lesser than calculated sum find the diffrence between calculated sum and sum, and add the diffrence to any one in the pair and see whether it lies between i<=limit which is 1 modification else move to another number in the pair and see whether it lies between i<=limit which is 1 modification else i need to modify both the numbers in the pair so 2 modification.\n4. so the modification count is calculated for each sum nums[i]-nums[nums.length()-1-i] and i store the min_count of modification and return it.\n\nSo, this is my approach am i correct?, where i\'m going worng because, 107/113 testcases passed.\nfailed test case arr=[20744,7642,19090,9992,2457,16848,3458,15721]\nlimit=22891\noutput=5\nexpected=4\n\n```\npublic int minMoves(int[] nums, int limit) {\n        int min_count=Integer.MAX_VALUE;\n        for(int i=0;i<nums.length/2;i++){\n           int max_sum=nums[i]+nums[nums.length-1-i];\n            int L=0;\n            int R=nums.length-1;\n            int count=0;\n            while(L<R){\n                if(nums[L]+nums[R]==max_sum){\n                    L++;\n                    R--;\n                }else{\n                    if(nums[L]+nums[R]>max_sum){\n                        int diff=(nums[L]+nums[R])-max_sum;\n                        if(nums[L]-diff>=1&&nums[L]-diff<=limit){\n                            count+=1;\n                        }else if(nums[R]-diff>=1&&nums[R]-diff<=limit){\n                            count+=1;\n                        }else{\n                            count+=2;\n                        }\n                    }else if(nums[L]+nums[R]<max_sum){\n                        int diff=max_sum-(nums[L]+nums[R]);\n                        if(nums[L]+diff>=1&&nums[L]+diff<=limit){\n                            count+=1;\n                        }else if(nums[R]+diff>=1&&nums[R]+diff<=limit){\n                            count+=1;\n                        }else{\n                            count+=2;\n                        }\n                    \n                    }\n                    L++;\n                    R--;\n                }\n            \n            }\n                System.out.println(count);\n\t\t\t\tmin_count=Math.min(count,min_count);\n    }\n        return min_count;\n    }\n```
['Java']