58. 배열 만들기 3
import Foundation func solution(_ arr:[Int], _ intervals:[[Int]]) -> [Int] { var answer : [Int] = [] for i in 0...intervals.count-1 { answer += Array(arr[In...
import Foundation func solution(_ arr:[Int], _ intervals:[[Int]]) -> [Int] { var answer : [Int] = [] for i in 0...intervals.count-1 { answer += Array(arr[In...
import Foundation func solution(_ num_list:[Int]) -> Int { var answer : Int = 0 for i in 0...num_list.count-1 { if num_list[i] < 0 { answer =...
import Foundation func solution(_ n:Int, _ slicer:[Int], _ num_list:[Int]) -> [Int] { var answer : [Int] = [] switch n { case 1 : answer = Array(num_lis...
import Foundation func solution(_ arr:[Int], _ idx:Int) -> Int { var answer : Int = 0 for i in idx ... arr.count-1 { if arr[i] == 1 { answer = i br...
import Foundation func solution(_ start:Int, _ end_num:Int) -> [Int] { var answer : [Int] = [] answer = (end_num ... start).map{$0} return answer.sorted(by:>) } ...
이렇게 한 이유.
import Foundation func solution(_ n:Int, _ k:Int) -> [Int] { var arr : [Int] = [] arr = (1...n).map{$0}.filter{$0 % k == 0} return arr } 이렇게 한 이유. 고차함수로 문제를 해결하려고 하였...
import Foundation func solution(_ num_list:[Int], _ n:Int) -> [Int] { var answer : [Int] = [] var N : Int = 0 N = n-1 answer = Array(num_list[N...]) return ...
import Foundation func solution(_ q:Int, _ r:Int, _ code:String) -> String { var answer : String = "" for i in 0 ... code.count-1 { if (i % q) == r { ...