■ Algorithm
-
[알고리즘] #쇠막대기■ Algorithm 2019. 4. 20. 23:18
출처 : https://programmers.co.kr/learn/courses/30/lessons/42585 알고리즘 연습 - 쇠막대기 | 프로그래머스 실행 결과가 여기에 표시됩니다. programmers.co.kr 문제 설명 여러 개의 쇠막대기를 레이저로 절단하려고 합니다. 효율적인 작업을 위해서 쇠막대기를 아래에서 위로 겹쳐 놓고, 레이저를 위에서 수직으로 발사하여 쇠막대기들을 자릅니다. 쇠막대기와 레이저의 배치는 다음 조건을 만족합니다. - 쇠막대기는 자신보다 긴 쇠막대기 위에만 놓일 수 있습니다. - 쇠막대기를 다른 쇠막대기 위에 놓는 경우 완전히 포함되도록 놓되, 끝점은 겹치지 않도록 놓습니다. - 각 쇠막대기를 자르는 레이저는 적어도 하나 존재합니다. - 레이저는 어떤 쇠막대기의 양 끝점과도..
-
[알고리즘] #Validate Binary Search Tree■ Algorithm 2019. 4. 18. 23:20
출처 : https://leetcode.com/problems/validate-binary-search-tree/ Validate Binary Search Tree - 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 문제 해석 주어진 이진 트리가 유효한 이진 탐색 트리 (BST)인지 확인하십시오. BST는 다음과 같이 정의됩니다: - 노드의 왼쪽 하위 트리에는 노드의 키보다 작은 키가 있는 노드 만 포함됩니다. - 노드의 오른쪽 하위 트리에는 노드의 키보다 큰 키..
-
[알고리즘] #Same Tree■ Algorithm 2019. 4. 18. 23:02
출처: https://leetcode.com/problems/same-tree/ Loading... 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 Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical and the nodes have the same valu..
-
[알고리즘] #Add Two Numbers■ Algorithm 2019. 4. 18. 11:06
출처: https://leetcode.com/problems/add-two-numbers/ Add Two Numbers - 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 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digi..
-
[알고리즘] #Two Sum■ Algorithm 2019. 4. 17. 23:29
출처: LeetCode https://leetcode.com/problems/two-sum/ Two Sum - 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 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, an..
-
[알고리즘] #전화번호 목록■ Algorithm 2019. 4. 16. 23:25
출처: https://programmers.co.kr/learn/courses/30/lessons/42577?language=java 알고리즘 연습 - 전화번호 목록 | 프로그래머스 실행 결과가 여기에 표시됩니다. programmers.co.kr 문제 설명 전화번호부에 적힌 전화번호 중, 한 번호가 다른 번호의 접두어인 경우가 있는지 확인하려 합니다. 전화번호가 다음과 같을 경우, 구조대 전화번호는 영석이의 전화번호의 접두사입니다. 구조대 : 119 박준영 : 97 674 223 지영석 : 11 9552 4421 전화번호부에 적힌 전화번호를 담은 배열 phone_book 이 solution 함수의 매개변수로 주어질 때, 어떤 번호가 다른 번호의 접두어인 경우가 있으면 false를 그렇지 않으면 true를..
-
[알고리즘] #완주하지 못한 선수■ Algorithm 2019. 4. 16. 10:32
출처: https://programmers.co.kr/learn/courses/30/lessons/42576 알고리즘 연습 - 완주하지 못한 선수 | 프로그래머스 실행 결과가 여기에 표시됩니다. programmers.co.kr 문제 설명 수많은 마라톤 선수들이 마라톤에 참여하였습니다. 단 한 명의 선수를 제외하고는 모든 선수가 마라톤을 완주하였습니다. 마라톤에 참여한 선수들의 이름이 담긴 배열 participant와 완주한 선수들의 이름이 담긴 배열 completion이 주어질 때, 완주하지 못한 선수의 이름을 return 하도록 solution 함수를 작성해주세요. 제한사항 마라톤 경기에 참여한 선수의 수는 1명 이상 100,000명 이하입니다. completion의 길이는 participant의 길이..