This is a demo task. You can read about this task and its solutions in this blog post.

A zero-indexed array A consisting of N integers is given. An equilibrium index of this array is any integer P such that 0 ≤ P < N and the sum of elements of lower indices is equal to the sum of elements of higher indices, i.e. 

A[0] + A[1] + ... + A[P−1] = A[P+1] + ... + A[N−2] + A[N−1].

Sum of zero elements is assumed to be equal to 0. This can happen if P = 0 or if P = N−1.

For example, consider the following array A consisting of N = 8 elements:

A[0] = -1 A[1] = 3 A[2] = -4 A[3] = 5 A[4] = 1 A[5] = -6 A[6] = 2 A[7] = 1

P = 1 is an equilibrium index of this array, because:

  • A[0] = −1 = A[2] + A[3] + A[4] + A[5] + A[6] + A[7]

P = 3 is an equilibrium index of this array, because:

  • A[0] + A[1] + A[2] = −2 = A[4] + A[5] + A[6] + A[7]

P = 7 is also an equilibrium index, because:

  • A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] = 0

and there are no elements with indices greater than 7.

P = 8 is not an equilibrium index, because it does not fulfill the condition 0 ≤ P < N.

Write a function:

class Solution { public int solution(int[] A); }

that, given a zero-indexed array A consisting of N integers, returns any of its equilibrium indices. The function should return −1 if no equilibrium index exists.

For example, given array A shown above, the function may return 1, 3 or 7, as explained above.

Assume that:

  • N is an integer within the range [0..100,000];
  • each element of array A is an integer within the range [−2,147,483,648..2,147,483,647].

Complexity:

  • expected worst-case time complexity is O(N);
  • expected worst-case space complexity is O(N), beyond input storage (not counting the storage required for input arguments).

Elements of input arrays can be modified.

Copyright 2009–2016 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.

 

출처: <https://codility.com/c/run/demoKN884W-Q3Z>

 

 

계속 모른다는데 깊은 내공이 느껴지네요. 경험주의자인 저에게 이렇게 실험을 많이 하는 분은 정말 존경합니다. "모른다"에 대한 뇌피셜을 말해보면, 환원주의는 통하지 않는다고 생각하는게 딥러닝 분야죠. 일반 분야라도 마찬가지 입니다. 수학의 f(x) -> Sum(f(x)) 처럼 코딩 레벨에서도 수많은 wrapping이 존재하는데 멀티 쓰레드를 쓰고 비동기 injection 코드들을 넣고 프레임웍에서 queue msg 구로 만든 후 그 현상을 기계어 코드로 번역 하고 분석해보려 해도 잘 안됩니다. helloWorld 를 프린트 하는데 프린트 하는 구문 뿐 아니라 해당 프로그램을 실행하는 덩어리 모두(OS의 컨택스트 스위칭 시켜주는 부분까지) 기계어 코드로 보고 역으로 이해하고 있는 것을 하나씩 분석하려 했을 때 많은 시간이 걸릴 것은 자명하죠. 목적과 ROI 문제로 귀결되는데

 

ALEXNET

비판 : 연금술, 블랙박스

 

Activation Functions

제프리힌튼 교수

시그모이드 30 붙잡고 ... ?

ReLU 쓰면 되는데

Vanishing Gradient Problem(기울기값이 사라지는 문제)

 

레이어 갯수 2 배수

 

 

high dimensional space

 

 

데이터 오해의 소지.

imageNet 개사진 100만장 = 1000개의 종류 * 1000

, 1000장으로 학습 시킴.

 

duprex

finding weights

 

turing test

 

IoT + AI + 3D(AR/VR)

 

(센서 데이터1 * 가중치 + coeficient) * Actication Function

(센서 데이터2 * 가중치 + coeficient)

 

 

AF is not Non-linear function

Non-linear function 직선 X

 

Multiple Layer

NN, hidden 2 이상 deep learning

 

input - hidden - output

 

layer 거칠 마다 non-linear function 추가됨.

 

학습데이터 : 연습문제

실생활데이터 : 시험

1 high bias (underfit) 2(just right) 3 함수(high variance, overfit)

 

풀어야 하는 문제는 간단한데 모델이 너무 복잡함

 

단순화 : dropout (랜덤하게)

Vanishing Gradient

 

학습량 = 미분값 * 출력값

 

non-linear activation function 미분했을 0 나오면 학습할 없음

 

ReLU 미분값  1 출력값 제한 없음

 

3D 모델의 경우 여러개 찍을 있음.

그러나 1장의 경우 여러 필터를 써서 이미지를 변환시킴.

 

https://ko.wikipedia.org/wiki/%ED%95%A9%EC%84%B1%EA%B3%B1

 

CNN

LeNet - 숫자 인식기

convolution - pooling - convolution - pooling

'Blog History' 카테고리의 다른 글

173  (0) 2020.04.14
172  (0) 2020.04.14
170  (0) 2020.04.14
169  (0) 2020.04.14
168  (0) 2020.04.14

+ Recent posts