Italiano
Apri in Telegram
DDeloitte | COGNIZANT | IBM | CAPGEMINI
Deloitte | COGNIZANT | IBM | CAPGEMINI
✅ Fiducia alta
@python_java_Coding · canale · Tecnologia · indicizzata dal 2026-07-19 archivio di febbraio 2023
7 178iscritti−36 in una settimana
560copertura media dei post
7.8%ER — copertura rispetto agli iscritti
13post in 30 giorni

Post di febbraio 2023

‹ febbraio 2023 ›×
Machine Learning coder
Foto
tocca per mostrare
Foto
tocca per mostrare
Foto
tocca per mostrare
Foto
tocca per mostrare
770 ·
M
Foto
tocca per mostrare
Foto
tocca per mostrare
Foto
tocca per mostrare
Foto
tocca per mostrare
VIRTUSA HACKATHON DONE SUCCESSFULLY ✅ 100% CLEARANCE Contact : @mlcoder2 Remote access available
914 ·
Happy
Foto
tocca per mostrare
Foto
tocca per mostrare
Foto
tocca per mostrare
Foto
tocca per mostrare
Foto
tocca per mostrare
Virtusa Hackthon done ✅
899 ·
public int solve(int[] A) {     int n = A.length;     int mod = 1000000007;     // calculate prefix sum and suffix sum arrays     long[] prefixSum = new long[n];     long[] suffixSum = new long[n];     prefixSum[0] = A[0];     suffixSum[n-1] = A[n-1];     for (int i = 1; i < n; i++) {         prefixSum[i] = prefixSum[i-1] + A[i];         suffixSum[n-1-i] = suffixSum[n-i] + A[n-1-i];     }     // calculate the maximum sum of one subarray from the left     long[] maxSumLeft = new long[n];     long curSum = 0;     long curMax = Long.MIN_VALUE;     for (int i = 0; i < n; i++) {         curSum += A[i];         curMax = Math.max(curMax, curSum);         maxSumLeft[i] = curMax;         curSum = Math.max(curSum, 0);     }     // calculate the maximum sum of one subarray from the right     long[] maxSumRight = new long[n];     curSum = 0;     curMax = Long.MIN_VALUE;     for (int i = n-1; i >= 0; i--) {         curSum += A[i];         curMax = Math.max(curMax, curSum);         maxSumRight[i] = curMax;         curSum = Math.max(curSum, 0);     }     // calculate the maximum sum of three subarrays     long maxSum = Long.MIN_VALUE;     for (int i = 1; i < n-1; i++) {         long sum1 = maxSumLeft[i-1];         long sum2 = maxSumRight[i+1];         long sum3 = prefixSum[i-1] + suffixSum[i+1];         maxSum = Math.max(maxSum, sum1+sum2+sum3);     }     return (int)(maxSum % mod); }
723 ·
In python def max_sum_subarrays(arr):     n = len(arr)     k = n // 3  # size of each window     mod = 10**3 + 7  # modulo value         # initialize windows     window1 = arr[:k]     window2 = arr[k:2*k]     window3 = arr[2*k:3*k]         # initialize sums     sum1 = sum(window1)     sum2 = sum(window2)     sum3 = sum(window3)         # iterate over the rest of the array and update windows and sums     for i in range(k, n-k):         sum1 += arr[i] - window1[i-k]         sum2 += arr[i+k] - window2[i-k]         sum3 += arr[i+2*k] - window3[i-k]                 # update windows         window1[i-k] = arr[i]         window2[i-k] = arr[i+k]         window3[i-k] = arr[i+2*k]                 # update maximum sums         sum1 = max(sum1, 0)         sum2 = max(sum2, 0)         sum3 = max(sum3, 0)         # return the positive remainder after dividing the sum with modulo value     return (sum1 + sum2 + sum3) % mod
703 ·
RispostaFoto
public int solve(int[] A) {     int n = A.length;     int mod = 1000000007;     // calculate prefix sum and suffix sum arrays     long[] prefixSum = new long[n];     long[] suffixSum = new long[n];     prefixSum[0] = A[0];     suffixSum[n-1] = A[n-1];     for (int i = 1; i < n; i++) {         prefixSum[i] = prefixSum[i-1] + A[i];         suffixSum[n-1-i] = suffixSum[n-i] + A[n-1-i];     }     // calculate the maximum sum of one subarray from the left     long[] maxSumLeft = new long[n];     long curSum = 0;     long curMax = Long.MIN_VALUE;     for (int i = 0; i < n; i++) {         curSum += A[i];         curMax = Math.max(curMax, curSum);         maxSumLeft[i] = curMax;         curSum = Math.max(curSum, 0);     }     // calculate the maximum sum of one subarray from the right     long[] maxSumRight = new long[n];     curSum = 0;     curMax = Long.MIN_VALUE;     for (int i = n-1; i >= 0; i--) {         curSum += A[i];         curMax = Math.max(curMax, curSum);         maxSumRight[i] = curMax;         curSum = Math.max(curSum, 0);     }     // calculate the maximum sum of three subarrays     long maxSum = Long.MIN_VALUE;     for (int i = 1; i < n-1; i++) {         long sum1 = maxSumLeft[i-1];         long sum2 = maxSumRight[i+1];         long sum3 = prefixSum[i-1] + suffixSum[i+1];         maxSum = Math.max(maxSum, sum1+sum2+sum3);     }     return (int)(maxSum % mod); }
1 · 869 ·
M
Machine Learning coder
Foto
tocca per mostrare
Foto
tocca per mostrare
LTTS DONE SUCCESSFULLY 🔥✅
888 ·
Calendario: febbraio 2023

Un feed pubblico aperto dall'indice di ricerca ChatCrawler — «Google per il Telegram pubblico»; si aggiorna man mano che la community viene scansionata. Orari in UTC.

Solo contenuti pubblici, API ufficiale di Telegram. Informazioni · FAQ · Limiti dell'indice · Rimuovi una pagina · Catalogo · Ricerca · Come calcoliamo