
https://school.programmers.co.kr/learn/courses/30/lessons/12917 문제 사진 내 풀이 func solution(_ s:String) -> String { return String(s.sorted(by: >)) } solution("Zbcdefg") // gfedcbZ 처음 생각했던 방법은 filter() 메서드를 사용하여 isLowercase, isUppercase 로 소문자, 대문자를 걸러서 sorted() 를 사용해 마지막으로 합칠 생각이었으나... sorted(by: >) 내림차순으로 정리하면 소문자(z ~ a) → 대문자 (Z ~ A) 순으로 알아서 정리를 해줬다.. 나름 머리를 굴렸지만 메서드 하나로 해결되는거에 신기하면서도 허탈했다 🌝
iOS
2022. 11. 15. 22:39
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- Swift 알고리즘
- ios
- swift programmers
- swift reduce
- Swift Leetcode
- Swift init
- 2023년 회고
- CS 네트워크
- Swift RIBs
- removeLast()
- Swift 프로그래머스
- swift 고차함수
- swift property
- Swift 내림차순
- Swift final
- Swift ModernRIBs
- 원티드 프리온보딩
- swift (programmers)
- iOS error
- Swift Error Handling
- Class
- RTCCameraVideoCapturer
- Swift joined
- Swift
- Combine: Asynchronous Programming with Swift
- Swift joined()
- Swift inout
- swift protocol
- Swift 프로퍼티
- RIBs tutorial
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함