• Skip to primary navigation
  • Skip to content
  • Skip to footer
Develop Record
  • About
  • Categories
  • tags
    1. Home
    2. /
    3. Leetcode_python
    4. /
    5. 151.Reverse Words in a string
    DDOING

    DDOING

    Record my study

    • Korea
    • GitHub
    • Instagram
    • 📂 Total Posts: 146
    • AI
      • Pytorch (10)
      • Paper (49)
      • Theory (18)
      • Report (1)
      • Troubleshooting (1)
      Program Language
      • Python (15)
      Algorithm
      • Programmers[Python] (3)
      • Leetcode[Python] (42)
      • BAEKJOON[Python] (5)
      Github
      • Github basic (1)

    151.Reverse Words in a string

    On This Page

    • My code
    • other code

    My code

    1
    2
    3
    4
    5
    
    class Solution:
        def reverseWords(self, s: str) -> str:
            ans = ' '.join(s.split()[::-1])
            
            return ans
    

    other code

    1
    2
    3
    
    class Solution:
        def reverseWords(self, s: str) -> str:
            return ' '.join([ch for ch in reversed(s.split()) if ch])
    

    태그: Leetcode, Python

    카테고리: Leetcode_Python

    업데이트: August 7, 2023

    이전 다음

    참고

    2024.04.30

    [Paper] Paint by Example: Exemplar-based Image Editing with Diffusion Models

    Paper Diffusion

    2024.04.17

    [Paper] DEVA: Anything with Decoupled Video Segmentation

    Paper Anything video_segmentation XMem

    2024.04.14

    [Paper] Video Panoptic Segmentation

    Paper Cityscape_VPS video_segmentation VIPER

    2024.04.12

    [Paper] Video Object Segmentation with Episodic Graph Memory Networks

    Paper video_segmentation
    • 팔로우:
    • GitHub
    • Instagram
    • 피드
    © 2024 DDOING. Powered by Jekyll & Minimal Mistakes.