๋ฌธ์
TapeEquilibrium coding task - Learn to Code - Codility
Minimize the value |(A[0] + ... + A[P-1]) - (A[P] + ... + A[N-1])|.
app.codility.com
๊ฒฐ๊ณผ
๋์ ํฉ
Test results - Codility
A non-empty array A consisting of N integers is given. Array A represents numbers on a tape. Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1]. The difference betw
app.codility.com
- answer ์ด๊ธฐํ๋ฅผ ์์ฃผ ํฐ ๊ฐ์ผ๋ก ํด๋์ผ ํ๊ณ (Math.abs(sum[A.length])๋ก ํ๋๊น ํ๋ ธ์๋ค.)
- 1 ~ A.length -1 ๊น์ง sum[i]๋ฅผ ํ์ฉํด์ ์ฐจ์ด๋ฅผ ๊ตฌํด์ผ ์ ๋ต์ด๋ค. A.length๊น์ง ๊ตฌํ๋ฉด ๋ ํ๋ฆผ..;
์ธํฐ๋ท ๊ฒ์ํ๋ฉด ์๋์ ๊ฐ์ ํ์ด๋ ์์
Test results - Codility
A non-empty array A consisting of N integers is given. Array A represents numbers on a tape. Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1]. The difference betw
app.codility.com
'๐ฅ PS(Problem Solving) ๐ฅ > Codility' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Codility] Lesson 4 Counting Elements : MaxCounters (0) | 2021.04.15 |
---|---|
[Codility] Lesson 4 Counting Elements : FrogRiverOne (0) | 2021.04.07 |
[Codility] Lesson 3 Time Complexity : PermMissingElem (0) | 2021.04.06 |
[Codility] Lesson 3 Time Complexity : FrogJmp (0) | 2021.04.05 |
[Codility] Lesson 2 Arrays : OddOccurrencesInArray (0) | 2021.04.05 |
๋๊ธ