728x90
SMALL

using System;

public class Solution {
    public int[] solution(string[] strlist) {
        int[] answer = new int[strlist.Length];


        for (int i = 0; i < strlist.Length; i++)
        {
            answer[i] = strlist[i].Length;
        }

// 각 Array에서 string Length를 취득한다.
        return answer;
    }
}

 

///////////

 

자바

 

class Solution {
    public int[] solution(String[] strlist) {
        int[] answer = new int[strlist.length];

        for(int i=0; i<strlist.length;i++)
        {
            answer[i]= strlist[i].length();
        }
        
        return answer;
    }
}

 

 

import java.util.Arrays;

class Solution {
    public int[] solution(String[] strList) {
        return Arrays.stream(strList).mapToInt(String::length).toArray();
    }
}
728x90

설정

트랙백

댓글