Back to Browse

Lesson 3: TapeEquilibrium | Codility for Programmers | Java | Problem Solving

845 views
Sep 1, 2020
13:38

A non-empty array A consisting of N integers is given. Array A represents numbers on a tape. In other words, it is the absolute difference between the sum of the first part and the sum of the second part. For example, consider array A such that: A[0] = 3 A[1] = 1 A[2] = 2 A[3] = 4 A[4] = 3 Write a function: class Solution { public int solution(int[] A); } that, given a non-empty array A of N integers, returns the minimal difference that can be achieved. For example, given: A[0] = 3 A[1] = 1 A[2] = 2 A[3] = 4 A[4] = 3 the function should return 1, as explained above. #Codility #TapeEquilibrium #ProblemSolving

Download

0 formats

No download links available.

Lesson 3: TapeEquilibrium | Codility for Programmers | Java | Problem Solving | NatokHD