-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhackerrank_alg_crush
More file actions
40 lines (30 loc) · 791 Bytes
/
Copy pathhackerrank_alg_crush
File metadata and controls
40 lines (30 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a;
int b;
int k=0;
a=sc.nexInt();
b=sc.nexInt();
ArrayList <Integer> ar = new ArrayList<Integer>();
while(b>0)
{
--b;
k= sc.nexInt();
int t=0;
for(int i=a;i<=b;i++)
{
t=ar.get(i);
ar.set(i,t+k);
}
}
Collections.sort(ar);
System.out.println(ar.get(0));
}
}