'알고리즘'에 관한 7개의 포스트

[Algorithm] Pots of gold game

원문 단순히 큰 값 두개씩 고른다고 생각하면 안되는 문제 A와 B 모두 자신에게 가장 유리한 값을 고른다는 조건이 관건이다. A가 왼쪽을 고른경우 + min(B가 다음 왼쪽을 고른경우, B가 오른쪽을 고른경우) A가 오른쪽을 고른것 + min(B…

[Algorithm] 막대 자르기

원본 : https://www.geeksforgeeks.org/cutting-a-rod-dp-13/ Cutting a Rod | DP-13 다음과 같이 단위 길이당 막대의 가격이 주어졌을 때 n…

[Algorithm] 0, 1, 2로 이루어진 배열 정렬하기

원본 : https://www.geeksforgeeks.org/sort-an-array-of-0s-1s-and-2s/ Sort an array of 0s, 1s and 2s 0,1,2 으로 이루어진 배열을 정렬하라 가장 심플한 방법은 0,1,…

[Algorithm][LeetCode] find the length of the longest substring without repeating characters

원문 : https://leetcode.com/problems/longest-substring-without-repeating-characters/ Given a string, find the length of the longest substring…
2020년 04월 04일

[Algorithm][hackerrank] Array Manipulation

원문 : https://www.hackerrank.com/challenges/crush/problem 배열의 길이, 배열의 구간별 가중치값들이 더해졌을 때 가장 높은 값을 가지고 있는 구간의 값을 출력하는 문제 a, b 는 구간을 나타내고 k…

[Algorithm][hackerrank] Between Two Sets

원문 : https://www.hackerrank.com/challenges/between-two-sets/problem You will be given two arrays of integers and asked to determine all…

[Algorithm][프로그래머스] 디스크 컨트롤러

디스크 컨트롤러(lv.3) 문제 링크 clock 을 선언하여 시간을 잰다. min타임에 최대값 1000 을 넣어 반복할때마다 1000으로 초기화 해준다. jobs 를 하나씩 뽑아서 clock 이하 중 최소작업시간에 해당되는 job…