https://school.programmers.co.kr/learn/courses/30/lessons/12948
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
function solution(phone_number)
{
var star = '****************'
var str1 = star.slice(0, phone_number.length-4);
var str2 = phone_number.slice(phone_number.length-4);
return str1+str2;
}
230916 C++
#include <string>
#include <vector>
using namespace std;
string solution(string phone_number) {
string starstring = "";
for (int i=0; i<phone_number.size()-4; i++){
starstring += "*";
}
string numberstring = phone_number.substr(phone_number.size()-4, 4);
return starstring + numberstring;
}
'코딩테스트 > LV. 1' 카테고리의 다른 글
LV. 1 :: 문자열 내림차순으로 배치하기 (0) | 2023.01.23 |
---|---|
LV. 1 :: 제일 작은 수 제거하기 (0) | 2023.01.23 |
LV. 1 :: 음양 더하기 (0) | 2023.01.23 |
LV. 1 :: 나누어 떨어지는 숫자 배열 (0) | 2023.01.23 |
LV. 1 :: 나머지가 1이 되는 수 찾기 (0) | 2023.01.23 |
댓글