Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 백준
- BFS: Shortest Reach in a Graph
- 격파르타 합격후기
- Interview Preparation Kit
- Algorithm
- Find the nearest clone
- Roads and Libraries
- 프로그래머스
- 격파르타 장점
- Special String Again
- 격파르타 후기
- hackerrank
- 머신러닝
- candies
- Reverse Shuffle Merge
- 야근지수
- Max Array Sum
- programmers
- Common Child
- 피보나치 함수
- 매칭점수
- 구슬탈출2
- 파이썬
- 해커랭크
- Recursion: Davis' Staircase
- 코딩테스트
- [sqld]자격증합격
- 알고리즘
- DFS: Connected Cell in a Grid
- python
Archives
- Today
- Total
목록Max Array Sum (1)
Archive

https://www.hackerrank.com/challenges/max-array-sum/problem Max Array Sum | HackerRank Find the maximum sum of elements in an array. www.hackerrank.com 풀이 입력으로 정수로 구성된 arr를 받을 때, 이웃하지 않은 element와의 최대합을 구하는 문제 n1, n2, n3 3개만 있고 swap해가면서 정답을 구할 수 있음. 보통 dp[i] = i번째 원소까지 봤을 때 최대합 으로 생각해 문제를 접근 n2를 초기화할 때 arr[1]로 하지 말고 max(2번째 원소까지) 음수 값도 존재하기 때문에, i번째 원소가 최대인 경우도 있음. max 값을 update할 때 자기 자신이 최대인 경우도..
공부/Algorithm
2020. 8. 31. 21:08