코딩 인터뷰(leetcode) Flashcards
(8 cards)
leetcode 53. Maximum Subarray
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
https://leetcode.com/problems/maximum-subarray/
class Solution: def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """
max_current = nums[0] ret = nums[0] for i in range(1, len(nums)): max_current = max(nums[i], max_current+nums[i]) ret = max(max_current, ret) return ret
leetcode 189. rotate array (네 가지 방법으로 풀 수 있음)
Given an array, rotate the array to the right by k steps, where k is non-negative.
Input: [1,2,3,4,5,6,7] and k = 3
Output: [5,6,7,1,2,3,4]
Explanation:
rotate 1 steps to the right: [7,1,2,3,4,5,6]
rotate 2 steps to the right: [6,7,1,2,3,4,5]
rotate 3 steps to the right: [5,6,7,1,2,3,4]
Input: [-1,-100,3,99] and k = 2
Output: [3,99,-1,-100]
Explanation:
rotate 1 steps to the right: [99,-1,-100,3]
rotate 2 steps to the right: [3,99,-1,-100]
https://leetcode.com/problems/rotate-array/
https://leetcode.com/problems/rotate-array/solution/
백준 11055 : 가장 큰 증가 부분 수열
https://www.acmicpc.net/problem/11055
https://www.acmicpc.net/source/9342428
백준 2206: 벽 부수고 이동하기
https://www.acmicpc.net/problem/2206
https://www.acmicpc.net/source/11319167
알고스팟(종만북) PI
https://algospot.com/judge/problem/read/PI
https://algospot.com/judge/submission/detail/597769
백준 9466 텀 프로젝트
https://www.acmicpc.net/problem/9466
http://blog.naver.com/gunwooyeon/220942236105
백준 16235 나무재테크
https://www.acmicpc.net/problem/16235
https://www.acmicpc.net/source/11430863
leetcode 238. Product of array except self
https://leetcode.com/problems/product-of-array-except-self/
https://leetcode.com/problems/product-of-array-except-self/