파비의 매일매일 공부기록

Today's Challenge 본문

Problem Solving/LeetCode

Today's Challenge

fabichoi 2022. 7. 19. 23:45

https://leetcode.com/problems/pascals-triangle/

 

Pascal's Triangle - 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

Easy 문제라 어렵진 않았음 ㅎㅎ
좀 더 짧은 코드를 찾아서 제출해봄.

class Solution:
    def generate(self, numRows: int) -> List[List[int]]:
        return list(accumulate([[1]]*numRows, lambda a,b: [x+y for x,y in zip(a+[0],[0]+a)]))
반응형

'Problem Solving > LeetCode' 카테고리의 다른 글

Today's Challenge  (0) 2022.07.21
Today's Challenge  (0) 2022.07.20
Today's Challenge  (0) 2022.07.18
Today's Challenge  (0) 2022.07.17
Today's Challenge  (0) 2022.07.16
Comments