■ Algorithm
-
[알고리즘] #Palindromic Substrings■ Algorithm 2019. 5. 12. 21:41
출처: https://leetcode.com/problems/palindromic-substrings/ 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 a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are counted as different s..
-
[알고리즘] #Daily Temperatures■ Algorithm 2019. 5. 12. 21:12
출처 : https://leetcode.com/problems/daily-temperatures/ Daily Temperatures - 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 a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer tem..
-
[알고리즘] #Longest Substring Without Repeating Characters■ Algorithm 2019. 5. 12. 20:54
출처: https://leetcode.com/problems/longest-substring-without-repeating-characters/ 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 a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer ..
-
[알고리즘] #Longest Univalue Path■ Algorithm 2019. 5. 7. 15:01
출처: https://leetcode.com/problems/longest-univalue-path/ 불러오는 중입니다... Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root. The length of path between two nodes is represented by the number of edges between them. (이진 트리가 주어지면 경로의 각 노드가 동일한 값을 갖는 가장 긴 경로의 길이를 찾습니다. 이 경로는 루트를 통과 할 수도 있고 통과하지 않을 수도 있습..
-
[알고리즘] #네트워크■ Algorithm 2019. 4. 24. 11:35
출처: https://programmers.co.kr/learn/courses/30/lessons/43162#qna 알고리즘 연습 - 네트워크 | 프로그래머스 실행 결과가 여기에 표시됩니다. programmers.co.kr 문제 설명 네트워크란 컴퓨터 상호 간에 정보를 교환할 수 있도록 연결된 형태를 의미합니다. 예를 들어, 컴퓨터 A와 컴퓨터 B가 직접적으로 연결되어있고, 컴퓨터 B와 컴퓨터 C가 직접적으로 연결되어 있을 때 컴퓨터 A와 컴퓨터 C도 간접적으로 연결되어 정보를 교환할 수 있습니다. 따라서 컴퓨터 A, B, C는 모두 같은 네트워크 상에 있다고 할 수 있습니다. 컴퓨터의 개수 n, 연결에 대한 정보가 담긴 2차원 배열 computers가 매개변수로 주어질 때, 네트워크의 개수를 retur..
-
[알고리즘] #타겟넘버■ Algorithm 2019. 4. 23. 21:30
출처: https://programmers.co.kr/learn/courses/30/lessons/43165 알고리즘 연습 - 타겟 넘버 | 프로그래머스 실행 결과가 여기에 표시됩니다. programmers.co.kr 문제 설명 n개의 음이 아닌 정수가 있습니다. 이 수를 적절히 더하거나 빼서 타겟 넘버를 만들려고 합니다. 예를 들어 [1, 1, 1, 1, 1]로 숫자 3을 만들려면 다음 다섯 방법을 쓸 수 있습니다. -1+1+1+1+1 = 3 +1-1+1+1+1 = 3 +1+1-1+1+1 = 3 +1+1+1-1+1 = 3 +1+1+1+1-1 = 3 사용할 수 있는 숫자가 담긴 배열 numbers, 타겟 넘버 target이 매개변수로 주어질 때 숫자를 적절히 더하고 빼서 타겟 넘버를 만드는 방법의 수를 ..
-
[알고리즘] #H-Index■ Algorithm 2019. 4. 22. 13:17
출처: https://programmers.co.kr/learn/courses/30/lessons/42747?language=java# 알고리즘 연습 - H-Index | 프로그래머스 실행 결과가 여기에 표시됩니다. programmers.co.kr 문제 설명 H-Index는 과학자의 생산성과 영향력을 나타내는 지표입니다. 어느 과학자의 H-Index를 나타내는 값인 h를 구하려고 합니다. 위키백과1에 따르면, H-Index는 다음과 같이 구합니다. 어떤 과학자가 발표한 논문 n편 중, h번 이상 인용된 논문이 h편 이상이고 나머지 논문이 h번 이하 인용되었다면 h가 이 과학자의 H-Index입니다. 어떤 과학자가 발표한 논문의 인용 횟수를 담은 배열 citations가 매개변수로 주어질 때, 이 과학자의..
-
[알고리즘] #K번째수■ Algorithm 2019. 4. 21. 14:31
출처 : https://programmers.co.kr/learn/courses/30/lessons/42748?language=java 알고리즘 연습 - K번째수 | 프로그래머스 실행 결과가 여기에 표시됩니다. programmers.co.kr 문제 설명 배열 array의 i번째 숫자부터 j번째 숫자까지 자르고 정렬했을 때, k번째에 있는 수를 구하려 합니다. 예를 들어 array가 [1, 5, 2, 6, 3, 7, 4], i = 2, j = 5, k = 3이라면 array의 2번째부터 5번째까지 자르면 [5, 2, 6, 3]입니다. 1에서 나온 배열을 정렬하면 [2, 3, 5, 6]입니다. 2에서 나온 배열의 3번째 숫자는 5입니다. 배열 array, [i, j, k]를 원소로 가진 2차원 배열 comm..