VinthaAnubhuthi Posted July 18, 2020 Report Share Posted July 18, 2020 Repu oka desi gaanitho interview sacchindhi. Ee question aduguthadanta. Konchem answer cheyyandi. 3 roles unnayi. Naaku job vasthe mimmalni kooda lagutha. Input ga oka array of integers isthe, output vacchi 'top 3 sub-arrays of 3 integers (triplets) with highest sum' kavali anta. Quote Link to comment Share on other sites More sharing options...
kittaya Posted July 18, 2020 Report Share Posted July 18, 2020 4 minutes ago, VinthaAnubhuthi said: Repu oka desi gaanitho interview sacchindhi. Ee question aduguthadanta. Konchem answer cheyyandi. 3 roles unnayi. Naaku job vasthe mimmalni kooda lagutha. Input ga oka array of integers isthe, output vacchi 'top 3 sub-arrays of 3 integers (triplets) with highest sum' kavali anta. Ivanni leet code budhuluuu Quote Link to comment Share on other sites More sharing options...
VinthaAnubhuthi Posted July 18, 2020 Author Report Share Posted July 18, 2020 Just now, kittaya said: Ivanni leet code budhuluuu answer copy cheyyocchu ga. Quote Link to comment Share on other sites More sharing options...
kittaya Posted July 19, 2020 Report Share Posted July 19, 2020 2 minutes ago, VinthaAnubhuthi said: answer copy cheyyocchu ga. Haaa Quote Link to comment Share on other sites More sharing options...
covid1990 Posted July 19, 2020 Report Share Posted July 19, 2020 class Solution { public int[] maxSumOfThreeSubarrays(int[] nums, int k) { // W is an array of sums of windows int[] W = new int[nums.length - k + 1]; int currSum = 0; for (int i = 0; i < nums.length; i++) { currSum += nums[i]; if (i >= k) { currSum -= nums[i - k]; } if (i >= k - 1) { W[i - k + 1] = currSum; } } int[] left = new int[W.length]; int best = 0; for (int i = 0; i < W.length; i++) { if (W[i] > W[best]) best = i; left[i] = best; } int[] right = new int[W.length]; best = W.length - 1; for (int i = W.length - 1; i >= 0; i--) { if (W[i] >= W[best]) { best = i; } right[i] = best; } int[] ans = new int[]{-1, -1, -1}; for (int j = k; j < W.length - k; j++) { int i = left[j - k], l = right[j + k]; if (ans[0] == -1 || W[i] + W[j] + W[l] > W[ans[0]] + W[ans[1]] + W[ans[2]]) { ans[0] = i; ans[1] = j; ans[2] = l; } } return ans; } } 1 Quote Link to comment Share on other sites More sharing options...
LungiLingaraju Posted July 19, 2020 Report Share Posted July 19, 2020 Sample input and output ichi saavu uncle Quote Link to comment Share on other sites More sharing options...
sri_india Posted July 19, 2020 Report Share Posted July 19, 2020 1 hour ago, VinthaAnubhuthi said: Repu oka desi gaanitho interview sacchindhi. Ee question aduguthadanta. Konchem answer cheyyandi. 3 roles unnayi. Naaku job vasthe mimmalni kooda lagutha. Input ga oka array of integers isthe, output vacchi 'top 3 sub-arrays of 3 integers (triplets) with highest sum' kavali anta. question chala tough gaaa udni ... pass bro Quote Link to comment Share on other sites More sharing options...
Sarvapindi Posted July 19, 2020 Report Share Posted July 19, 2020 13 minutes ago, sri_india said: question chala tough gaaa udni ... pass bro nenu fail..programming asal ekkatle va burra ki Quote Link to comment Share on other sites More sharing options...
Doravaru Posted July 19, 2020 Report Share Posted July 19, 2020 1 minute ago, Sarvapindi said: nenu fail..programming asal ekkatle va burra ki Tension padaku kaka learn Salesforce or Workday comparatively easy to learn and demanding technologies Quote Link to comment Share on other sites More sharing options...
Sarvapindi Posted July 19, 2020 Report Share Posted July 19, 2020 5 minutes ago, Doravaru said: Tension padaku kaka learn Salesforce or Workday comparatively easy to learn and demanding technologies Salesforce also edo programming untadi ga Quote Link to comment Share on other sites More sharing options...
Doravaru Posted July 19, 2020 Report Share Posted July 19, 2020 4 hours ago, Sarvapindi said: Salesforce also edo programming untadi ga Not that hard ... Workday kuda try cheyyochu Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.