Algorithm

Algorithm/프로그래머스

[ 프로그래머스 ] 문자열 반복해서 출력하기

문제 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr코드import Foundationlet inp = readLine()!.components(separatedBy: [" "]).map { $0 }let (s1, a) = (inp[0], Int(inp[1])!)for i in 1...a { print(s1, terminator:"")} 💡 풀이public func print( _ items: Any..., separator: String = " ", terminator: String = "\n")​print의 매개변수를 활용.

Algorithm/프로그래머스

[ 프로그래머스 ] a와 b 출력하기

문제 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 코드import Foundationlet n = readLine()!.components(separatedBy: [" "]).map { Int($0)! }let (a, b) = (n[0], n[1])print("a = \(a)")print("b = \(b)") 💡 풀이문자열 보간(String interpolation)을 활용.

Algorithm/프로그래머스

[ 프로그래머스 ] 문자열 출력하기

문제 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr코드import Foundationlet s1 = readLine()!print(s1) 💡 풀이readLine()에 대해 아는지 확인해보자.

Algorithm/LeetCode

26. Remove Duplicates from Sorted Array

26. Remove Duplicates from Sorted Array Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. Then return the number of unique elements in nums. Consider the number of unique elements of nums to be k, to get accepted, you need to do the following thing..

Algorithm/LeetCode

1. Two Sum

1. Two Sum Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1 Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we return ..

Algorithm/LeetCode

1929. Concatenation of Array

1929. Concatenation of Array Given an integer array numsof length n, you want to create an array ans of length 2n where ans[i] == nums[i] and ans[i + n] == nums[i] for 0

Sheep1sik
'Algorithm' 카테고리의 글 목록 (4 Page)