반응형
Recent Posts
Notice
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- string
- ArrayList
- two pointers
- recursion
- 부분배열
- Java
- 재귀함수
- Array
- 리트코드
- DP
- HashMap
- hashset
- binary tree
- dfs
- leetcode
- 브루트포스
- priority queue
- programmers
- coding
- 우선순위 큐
- PCCP
- 알고리즘
- 깊이우선탐색
- Algorithm
- greedy
Archives
- Today
- Total
목록부분배열 (2)
지식창고
[Java] LeetCode 491. Non-decreasing Subsequences
[Java] LeetCode 491. Non-decreasing Subsequences 문 제 : 정수형 1차원 배열 nums가 주어진다. 증가하는 형태의 부분배열을 모두 구하여라. { 1 모든 부분배열을 구해야하기 때문에 현재 인덱스가 생략된 상태의 부분배열을 구하기 위함이다. 모든 상황 : 인덱스만 +1 한 후 다시 solve 함수를 호출한다. -> 이렇게 되면 pre에 저장되어 있는 값은 그대로이기 때문에 index와 pre값이 차이가 벌어지게 되고, 붙어있지 않는 부분배열도 검사할 수 있게 된다. 결 과 : class Solution { public List findSubsequences(int[] nums) { Set set = new HashSet(); List temp = new ArrayL..
Algorithm/Leetcode
2023. 1. 20. 15:12