본문 바로가기

SW171

1423. Maximum Points You Can Obtain from Cards(Medium) Maximum Points You Can Obtain from Cards - 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 class Solution: def maxScore(self, cardPoints: List[int], k: int) -> int: # #Find Min Sum in a row # sum_in_a_row_dict = dict() # key : (start_idx, # of elemnets) value : sum # sum_in_a_row_d.. 2020. 12. 9.
1.1. RDD(Resilient Distributed Dataset) RDD : 스파크가 사용하는 핵심 데이터 모델. 다수의 서버에 걸쳐 분산 방식으로 저장된 데이터 요소돌의 집합을 의미. 병렬 처리 가능, 장애가 발생할 경우에도 스스로 복구될 수 있는 내성. 스파크는 작업을 수행할 때 파티션(RDD를 구성하는 단위) 단위로 나눠서 병렬로 처리를 수행. 하나의 RDD가 이렇게 여러 파티션으로 나눠져 다수의 서버에서 처리되다 보니 작업 도중 일부 파티션에 장애가 발생해서 데이터가 유실될 수 있는데, 스파크는 손상된 RDD를 원래 상태로 다시 복원하기 위해 RDD의 생성 과정을 기록해 뒀다가 다시 복구해주는 기능을 가지고 있음. 단, 복구 수행을 위해서는 한번 생성된 RDD가 바뀌지 않아야 함. RDD는 스파크의 데이터 모델이면서 동시에 프로그래밍 API map, flatMa.. 2020. 12. 8.
1장. 스파크 소개 빅데이터 : 크기(Volume), 다양성(Variety), 속도(Velocity). 가변성(Variability), 정확성(Veracity), 복잡성(Complexity), 시인성(Visibility) ... 데이터 프로세스 : 수집 → 저장 및 처리 (CRUD, Create Read Update Delete) → 분석 및 가공 - 수집 : 카프카(Kafka) ... - 저장 및 처리 : 하둡(Hadoop), 스파크(Spark) ... - YARN : CPU와 메모리 등 컴퓨팅 자원 관리를 전담하는 리소스 관리 시스템 - HDFS(Hadoop File System)의 기초가 된 “The Google File System”(2003), Map Reduce(2004) - 맵리듀스 프레임워크 : 데이터 처리 .. 2020. 12. 8.
304. Range Sum Query 2D - Immutable(Medium) Range Sum Query 2D - Immutable - 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 이것도 DP문제라면 DP문제. 합을 누적해서 활용해야 하니깐. 가장 큰 사각형에서 row기준, col기준으로 각각 빼주고 중복뺀건 더해주면 된다. class NumMatrix: matrix = list() matrix_sum = dict() def sumArr(self, row, col): sum = 0 for i in range(row+1): sum += .. 2020. 11. 5.
1640. Check Array Formation Through Concatenation(Easy) Check Array Formation Through Concatenation - 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 단순 배열을 잘 돌아다니는 For문 문제다. 2트만에 Accepted가 되었다... easy인데... 처음 제출했을때 문제를 잘못 이해하고 있었다. pieces는 순서를 바꿔서 합칠수 있다! easy 문제는 풀지 말아야되나... class Solution: def canFormArray(self, arr: List[int], piece.. 2020. 11. 5.
1301. Number of Paths with Max Score(Hard) Number of Paths with Max Score - 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 문제 자체는 심플한 DP문제다. 어렸을 적 왕수학(?) 계산법으로 경로의 수를 구하는 방법이 결국엔 DP아니었나 싶다. 4트만에 Accepted가 되었는데... 문제를 풀면서 2개의 삽질이 있었다. 1개의 프로그래밍 언어적 잘못과 1개의 문제를 이해하지 못한 잘못이다. 1. 이중 리스트로 배열을 만드는데, 리스트 객체를 가지는 리스트를 만들어서 참조로 인한 .. 2020. 11. 3.