Refactored all solutions

This commit is contained in:
rshaghoulian
2017-04-05 18:42:35 -05:00
parent 5f4c2f4a78
commit decc8e791e
135 changed files with 848 additions and 849 deletions
@@ -4,12 +4,15 @@
import java.util.Scanner;
public class Solution {
// Our subarray must be contiguous, so we have O(n^2) contiguous subarrays
// Time Complexity: O(n^2)
// Space Complexity: O(1)
public class Solution {
public static void main(String[] args) {
/* Read and save input */
/* Save input */
Scanner scan = new Scanner(System.in);
int size = scan.nextInt();
int size = scan.nextInt();
int [] array = new int[size];
for (int i = 0; i < size; i++) {
array[i] = scan.nextInt();
@@ -19,7 +22,6 @@ public class Solution {
System.out.println(negativeSubarrays(array));
}
/* O(n^2) runtime */
private static int negativeSubarrays(int [] array) {
int count = 0;
int sum = 0;