일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 알고리즘
- 시뮬레이션
- 수학
- 마곡속눈썹연장
- 정렬
- 딥러닝
- 운영체제
- ai/bigdata
- 투포인터
- 다시보기
- 삼성SW역량테스트
- 삼성 SW역량테스트 기출
- 삼성
- 등촌동속눈썹연장
- 리트코드
- 추석트래픽
- 백준
- 직무면접
- 코딩테스트
- leetcode
- 마곡속눈썹펌
- level2
- Java
- OS
- 포스코
- 1차면접
- BOJ
- 등촌동속눈썹펌
- 프로그래머스
- 카카오
- Today
- Total
목록알고리즘 (5)
기록하는 습관을 들이자
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/s52Cl/btqT90TBWQn/5cZ1zZGo2N4lg7EH5k6l41/img.png)
문제 leetcode.com/problems/valid-parentheses/ Valid Parentheses - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 풀이 주어진 괄호 문자열이 올바른 문자열인지 판단하는 간단한 알고리즘입니다. "스택" 자료구조를 사용하여 문제를 해결하면 됩니다. 문자열에서 등장할 수 있는 괄호 유형에 대해 번호를 매긴 후, 여는 괄호가 등장할 때는 해당 괄호에 대응하는 번호를 스택에 push 해주고, 닫는 괄호가 등장할 때는 현..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/3zuvV/btqT19aZMuL/xuC3Lb0ghzE4dzzQC3UkKk/img.jpg)
문제 leetcode.com/problems/get-maximum-in-generated-array/ Get Maximum in Generated Array - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 풀이 문제에 주어진 규칙대로 배열을 하나 생성한 뒤, 해당 배열에서 가장 큰 값을 리턴해주는 메소드를 작성하면 된다. 문제에 주어진 규칙을 살펴보면, nums[0] = 0; nums[1] = 1; 1) 인덱스가 짝수인 경우 nums[i] = nums[i..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cXOXI4/btqTV8c6Ram/ALZaNGhBocKpffLkKs5ZO0/img.jpg)
문제 leetcode.com/problems/kth-largest-element-in-an-array/ Kth Largest Element in an Array - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 풀이 리트코드 문제 난이도는 Medium에 해당하는데 개인적으로 가장 기초적인 문제라고 생각한다. 배열을 라이브러리를 사용해서 정렬만 해주면 간단하게 풀리는 문제이다. 나의 경우에는 자바를 이용하여 문제를 풀었기 때문에 nums 배열을 Arrays ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/RPs9X/btqSELYqB7j/WKz5M8kvjp6fk0955MQUFK/img.png)
문제 leetcode.com/problems/the-kth-factor-of-n/ 문제 풀이 간단히 약수를 구할 줄 아느냐를 묻는 문제입니다. 주어진 n의 약수들 가운데 k번째 약수를 리턴해주는 함수를 작성하면됩니다. 저는 1부터 n까지 for문을 돌리면서 나누어 떨어지는 수(즉, 약수) 가운데 k번째 수를 구하면 해당 수를 바로 리턴, n까지 for문을 돌렸는데 해당 수를 찾지 못하면 -1을 리턴하도록 작성하였습니다. 코드 class Solution { public int kthFactor(int n, int k) { int num = 0; for(int i=1;i
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/6k6lw/btqDVuJVFhA/TU2ms7DVUbiKbJpdlQZos0/img.png)
참고 https://m.blog.naver.com/kks227/220795165570 투 포인터(Two Pointers Algorithm), 슬라이딩 윈도우(Sliding Window) (수정: 2019-09-09) 조금 성향이 비슷하다고 생각하는 기법 2개를 함께 쓰려 합니다.첫 번째로 소개해드릴 기법은 투 포인터(tw... blog.naver.com 투 포인터 알고리즘에 대해 알아보겠습니다. 가끔 브루트 포스로 문제를 풀다보면 N이 큰 경우에는 시간초과가 발생하게 되는데, 그 때 완전 탐색이 아닌 다른 방법으로 어떻게 풀까하다가 알게 된 알고리즘입니다. ★ 완전 탐색 시 시간 초과가 나는 경우 ★ 1. 투 포인터 알고리즘 시도해보기 2. 이분 탐색 시도해보기(binary search) 3. dp(Dy..