FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [View Raw Code]   [Original HTTPS Page]

Algorithm_Solution/programmers/level1/solution51.md at main · dev-dahye/Algorithm_Solution · GitHub

Latest commit

 

History

History
24 lines (20 loc) · 597 Bytes

File metadata and controls

24 lines (20 loc) · 597 Bytes

프로그래머스 Level1 : 연습문제 핸드폰 번호 가리기

class Solution {
    public String solution(String phone_number) {
        String answer = "";
        StringBuilder sb = new StringBuilder();
        int l = phone_number.length();
        
        for(int i=0; i<l; i++){
            if(i<l-4){
                sb.append("*");
            } else{
                sb.append(phone_number.charAt(i));
            }
        }
        
        answer = sb.toString();
        return answer;
    }
}

Back | FazBrowse Home | New Git URL