๊ด€๋ฆฌ ๋ฉ”๋‰ด

JiYoung Dev ๐Ÿ–ฅ

[Java] ๋ฌธ์ž์—ด์—์„œ ๋ฐฐ์—ด๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐฉ๋ฒ• ๋ณธ๋ฌธ

Question

[Java] ๋ฌธ์ž์—ด์—์„œ ๋ฐฐ์—ด๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐฉ๋ฒ•

Shinjio 2023. 7. 28. 08:47

toCharArray()

 

class Solution {
	public int solution(String message) {
		int answer = 0;
		
//		for(int i = 0 ; i < message.length() ; i++) {
//			answer += 2;
//		}
		
		char[] arr = message.toCharArray();
		
		System.out.println(Arrays.toString(arr));
		
		int size = arr.length;
		answer = size * 2;
		
		return answer;
	}
}