leetcode 14

[LeetCode] Array > Single Number

leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/549/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com 풀이 배열을 오름차순으로 정렬하여 현재의 수와 다음 수를 비교, 같다면 반복횟수를 +1 해줌. 만약 다르고 반복횟수 또한 1이라면 그것은 Single Number 다..

[LeetCode] Array > Contains Duplicate

leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/578/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com 풀이 파이썬의 set 자료형을 사용하여 중복 존재 유무 판단 class Solution: def containsDuplicate(self, nums: List[int..

[LeetCode] Array > Best Time to Buy and Sell Stock II

leetcode.com/explore/featured/card/top-interview-questions-easy/92/array/564/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com 풀이 Greedy를 사용하여 문제를 해결하였다. 단순하게 오늘의 가격보다 내일의 가격이 높으면 매도하는 방식으로 가장 높은 이익을 구하였다. class Solution..

[LeetCode] Array > Remove Duplicates from Sorted Array

leetcode.com/explore/featured/card/top-interview-questions-easy/92/array/727/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com 풀이 정렬된 배열에서 중복을 제거하는 것이 문제이다. 가장 간단한 방법은 set에 담아 중복을 제거하고 list로 변환 후 정렬을 하는 것이 가장 간단할 것이다. 하지..

반응형