[Data Structure] 연결 리스트(Linked List)
·
Computer Science/Data Structure
연결 리스트(Linked List)란? 연결 리스트(Linked List)는 각 노드가 데이터와 포인터를 가지고 한 줄로 연결되어 있는 방식으로 데이터를 저장하는 자료 구조이다. 데이터를 담고 있는 노드들이 연결되어 있는데, 노드의 포인터가 다음이나 이전의 노드와의 연결을 담당하게 된다. 연결 리스트(Linked List)의 종류 단순 연결 리스트(Singly linked list) 단일 연결 리스트(Singly linked list)는 각 노드에 자료 공간과 한 개의 포인터 공간이 있고, 각 노드의 포인터는 다음 노드를 가리킨다. 이중 연결 리스트(Doubly linked list) 단순 연결 리스트(Singly Linked List)는 next로 현재 노드에서 다음 노드로 갈 수 있지만 이전 노드로는..
[Java] SOLID란?
·
Java
SRP 단일 책임 원칙(Single responsibility principle) 한 클래스는 하나의 책임만 가져야 한다는 원칙이다. OCP 개방-폐쇄 원칙(Open/closed principle) 소프트웨어 요소는 확장에는 열려 있으나 변경에는 닫혀 있어야 한다는 원칙이다. 다형성을 활용해야 한다. LSP 리스코프 치환 원칙(Liskov substitution principle) 프로그램의 객체는 프로그램의 정확성을 깨뜨리지 않으면서 하위 타입의 인스턴스로 바꿀 수 있어야하는 원칙으로 상위 타입을 상속해서 재정의 했을 때 프로그램이 깨지지 않아야 함을 의미한다. ISP 인터페이스 분리 원칙(Interface segregation principle) 특정 클라이언트를 위한 인터페이스 여러 개가 범용 인터..
[Java] 객체지향이란?
·
Java
객체지향이란? 객체지향 프로그래밍(Object-Oriented Programming, OOP)은 프로그램을 실제 세상에 가깝게 모델링하는 컴퓨터 프로그래밍 패러다임 중 하나로, 실제 세계의 데이터를 추상화 시켜 프로그래밍에서 상태와 행위를 가진 객체를 만들고, 그 객체들 간의 유기적인 상호작용으로 구성하는 프로그래밍 방법이다. 객체 지향 프로그래밍은 컴퓨터 프로그램을 명령어의 목록으로 보는 시각에서 벗어나 여러 개의 독립된 단위, 즉 "객체"들의 모임으로 파악하고자 하는 것이다. 각각의 객체는 메시지를 주고받고, 데이터를 처리할 수 있다. OOP의 4가지 특징 추상화 구체적인 사물들의 공통적인 특징을 파악해서 이를 하나의 개념(집합)으로 다루는 것이다. 즉 객첵들의 공통적인 특징(속성, 기능)을 모아 하..
[LeetCode] 152. Maximum Product Subarray - 파이썬(Python)
·
Solving Algorithm Problem/LeetCode
문제 링크 : https://leetcode.com/problems/maximum-product-subarray/ Maximum Product Subarray - 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 유형 : 동적 계획법(Dynamic Programming) 문제 설명 정수 배열 nums가 주어질 때, 가장 큰 곱 값을 갖는 연속적인 하위 배열을 return 하는 문제이다. 이때, 하위 배열의 요소들은 연속되어야 한다. 예를 들어 num = [1,2,3..
[LeetCode] 53. Maximum Subarray - 파이썬(Python)
·
Solving Algorithm Problem/LeetCode
문제 링크 : https://leetcode.com/problems/maximum-subarray/ Maximum Subarray - 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 유형 : 동적 계획법(Dynamic Programming) 문제 설명 정수 배열 nums가 주어지면, 가장 큰 합을 갖는 연속적인 하위 배열(최소한 하나의 숫자를 포함)을 찾아 return 하는 문제이다. 하위 배열은 배열의 연속적인 부분이다. Example 1) Input: nums..
[LeetCode] 91. Decode Ways - 파이썬(Python)
·
Solving Algorithm Problem/LeetCode
문제 링크 : https://leetcode.com/problems/decode-ways/ Decode Ways - 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 유형 : 동적 계획법(Dynamic Programming) 문제 설명 숫자만 포함된 문자열 s가 주어지면 이를 디코딩하는 방법의 수를 return 하는 문제이다. A~Z까지의 문자들은 아래와 같이 숫자로 인코딩할 수 있다. 'A' -> '1' 'B' -> '2' ... 'Z' -> '26' 인코딩된 메..
[LeetCode] 322. Coin Change - 파이썬(Python)
·
Solving Algorithm Problem/LeetCode
문제 링크 : https://leetcode.com/problems/coin-change/ Coin Change - 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 유형 : 동적 계획법(Dynamic Programming) 문제 설명 각각 다른 금액의 동전이 담긴 정수 배열 coins와 총 금액을 나타내는 정수 amount가 주어질 때, 해당 금액을 구성하는 데 필요한 동전의 최소 개수를 return 하는 문제이다. 각 종류의 동전은 무한히 있다고 가정한다(같은 ..
[LeetCode] 64. Minimum Path Sum - 파이썬(Python)
·
Solving Algorithm Problem/LeetCode
문제 링크 : https://leetcode.com/problems/minimum-path-sum/ Minimum Path 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 유형 : 동적 계획법(Dynamic Programming) 문제 설명 음수가 아닌 숫자들로 채워진 m x n 크기의 2차원 배열 grid가 주어질 때, 왼쪽 위에서 오른쪽 아래로 이어지는 경로 중 합이 최소가 되는 경로의 합을 찾아 return 하는 문제이다. 경로를 탐색할 때는 아래..
[LeetCode] 746. Min Cost Climbing Stairs - 파이썬(Python)
·
Solving Algorithm Problem/LeetCode
문제 링크 : https://leetcode.com/problems/min-cost-climbing-stairs/ Min Cost Climbing Stairs - 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 유형 : 동적 계획법(Dynamic Programming) 문제 설명 계단을 밟는 비용이 담긴 정수 배열 cost가 주어질 때, 계단 꼭대기에 도달하기 위한 최소 비용을 return 하는 문제이다. 이때, 비용을 지불하면 계단을 1칸 또는 2칸을 오를 수 ..