[Python] 파이썬/Leetcode_Easy
-
[Leetcode] 1200. Minimum Absolute Difference (In Python)[Python] 파이썬/Leetcode_Easy 2021. 12. 20. 22:44
코드들은 https://github.com/Eastar-DS/Python/tree/main/Leetcode의 Easy_Problem.py 파일에도 있습니다. 처음 푼 코드. 1. 정렬한다. 2. min값 잡으면서 output에 모든 diff들을 넣는다. (최솟값은 무조건 바로옆에있는걸 빼는거니까.) 3. output에서 min값만 남긴다. Easy 난이도이기도하고 결과가 속도가 느려서 좀더 늘려보려고 생각해보았다. 1.정렬한다. 2. minimum값을 설정하면서 여지껏 쌓아두던 output이 minimum값보다 작으면 버려버린다. 단계를 줄였는데도 80%속도밖에안나온다. output을 순간적으로 쌓지 않고도 만드는 방법이 있단말인가...? 디스커스는 3줄풀이가 있었는데 처음 풀이와 원리는 같다. 아마 코..
-
[Leetcode] 9. Palindrome Number (In Python)[Python] 파이썬/Leetcode_Easy 2021. 1. 4. 18:38
간략한 코드들은 github.com/Eastar-DS/Python 의 Leetcode 폴더에도 있습니다 Eastar-DS/Python Contribute to Eastar-DS/Python development by creating an account on GitHub. github.com Palindrome이란? 글자를 거꾸로 읽어도 똑같은 것들. 기러기는 거꾸로 해도 기러기! Constraints: -2^31
-
[Leetcode] 7. Reverse Integer (In Python)[Python] 파이썬/Leetcode_Easy 2021. 1. 3. 19:38
간략한 코드들은 github.com/Eastar-DS/Python 의 Leetcode 폴더에도 있습니다 Eastar-DS/Python Contribute to Eastar-DS/Python development by creating an account on GitHub. github.com Given a 32-bit signed integer, reverse digits of an integer. Note: Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [−2^31, (2^31) − 1]. For the purpose of this problem, a..