세로읽기
-
[프로그래머스] 세로 읽기알고리즘 노트 2023. 10. 19. 10:06
주어진 my_string 문자열을 m개의 문자로 묶음을 지어서 그 중 c번째의 글짜를 추출하면 result값이 나오게 됩니다. [문제풀이] 1. IntStream 클래스의 range() 함수로 loop를 구현합니다. 2. filter() 함수를 통해 m의 배수 자리를 구합니다. 3. 그렇게 구해진 l 값을 활용해 my_string의 문자열을 잘라내고, charAt을 활용해 잘란 문자열에서 원하는 문자를 가져옵니다. 4. map() 함수를 통해 char형을 String으로 바꾼 후 Collectors.joning()을 통해 문자열로 반환을 합니다.