목록분류 전체보기 (167)
알맹이방
아 왜 맨날 인덱스 참조 오류 나냐 진짜 지겨워 죽겠네
프로그래머스 구글링 안 하고 혼자 힘으로 2시간 반동안 걸림! 뿌듯하다! 이해가 안 가는 부분이 있으면 댓글로 문의해주세요 import java.util.LinkedList; class Solution { public int solution(int cacheSize, String[] cities) { int answer = 0; LinkedList lru = new LinkedList(); int size= 0; int time=0; for(int i =0; i0){//캐쉬 사이즈가 0보다 크다면 if(size==0){ //캐쉬가 비어있다면 lru.add(cities[i]); time++; size++; } else{ //캐쉬가 비어있지 않다면 boolean flag = false; //캐쉬 안에 해당 ..
구글링 하지 않으려고 노력하자. 최소 2시간 혼자 고민하자. 오늘 공부할 것 https://programmers.co.kr/learn/courses/30/lessons/17680 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr https://j2wooooo.tistory.com/121 LRU 알고리즘 (Least Recently Used Algorithm) LRU 알고리즘 (Least Recently Used Algorithm) LRU 알고리즘 : 가장 오랫동안 참조되지 않은 페이지를 교체하는 기법 LRU 알고리즘의 자세한 설명에 앞서 간단한 배경 지식을 ..
import java.util.*; class Solution { public int solution(int[] priorities, int location) { int answer = 1; PriorityQueue pri = new PriorityQueue(Collections.reverseOrder()); for(int i : priorities){ //priorities에 있는 원소i를 큐에 넣는다 pri.add(i); } while(!pri.isEmpty()){ //아래 for문도 계속 반복됨. priorities가 큐처럼 작용. for(int i = 0; i