반응형
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
- 부분배열
- hashset
- 브루트포스
- HashMap
- greedy
- Algorithm
- Java
- 재귀함수
- binary tree
- Array
- 깊이우선탐색
- 알고리즘
- 리트코드
- string
- recursion
- leetcode
- 우선순위 큐
- ArrayList
- priority queue
- two pointers
- programmers
- DP
- PCCP
- dfs
- coding
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