leetcode 14

[LeetCode] Sorting and Searching > Merge Sorted Array

https://leetcode.com/explore/interview/card/top-interview-questions-easy/96/sorting-and-searching/587/ 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 풀이 in-place 방식으로 문제를 해결해야하므로 슬라이싱을 사용할 수 없다. 나는 병합한 배열의 총 길이가 m + n ..

[LeetCode] Strings > Longest Common Prefix

https://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/887/ 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 풀이 Prefix 검증의 기준 문자열을 가장 길이가 짧은 문자열로 잡고 진행 기준 문자열[i] 과 다른 모든 문자열의 [i]가 같다면 prefix..

[LeetCode] Strings > Valid Palindrome

https://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/883/ 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 풀이 Palindrome이란 뒤집어도 동일한 문자를 뜻한다. isdigit과 isalpha 메서드를 통해 문자와 숫자만 리스트에 담고 이 리스트와..

[LeetCode] Strings > Valid Anagram

https://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/882/ 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 풀이 파이썬 dictionary 자료형을 사용하여 문제를 해결하였다. Anagram이란 cat, act / teem, meet 와 같이 한 단어를..

[LeetCode] Array > Two Sum

leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/546/ 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 풀이 2중 for문을 통해 Brute-Force를 진행하면 해결할 수 있지만, 이를 조금 개선하여 해결 배열 내 x, y의 합이 target이 되려면 x를 기준으로 ..

[LeetCode] Array > Plus One

https://leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/559/ 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 풀이 deque라이브러리를 사용하여 큐를 만들고 각 자릿수가 10을 넘으면 다음 자릿수를 추가하거나 한자리 올려주는 식으로 하려고 하다가, 그냥 단순 ..

[LeetCode] Array > Intersection of Two Arrays II

leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/674/ 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자료형의 intersection 함수를 사용하였지만, 반례로 [1,2,2,1] , [2,2]가 존재하였다. 중복되는 숫자가 사라지기 때문에 ..

반응형