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