MCPcopy Create free account
hub / github.com/SAKET-SK/Programming-Aptitude-Interview-Prep / main

Method main

TCS/Que 5/Solution.java:4–24  ·  view source on GitHub ↗
(String[]args)

Source from the content-addressed store, hash-verified

2class Solution
3{
4 public static void main (String[]args)
5 {
6 Scanner sc = new Scanner (System.in);
7 int t = sc.nextInt ();
8 int e[] = new int[t];
9 int l[] = new int[t];
10
11 for (int i = 0; i < t; i++)
12 e[i] = sc.nextInt ();
13
14 for (int i = 0; i < t; i++)
15 l[i] = sc.nextInt ();
16
17 int max = 0, sum = 0;
18 for (int i = 0; i < t; i++)
19 {
20 sum += e[i] - l[i];
21 max = Math.max (sum, max);
22 }
23 System.out.println (max);
24 }
25}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected