📌 문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/181872
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요....
programmers.co.kr
✅ 내 풀이(Success) :
![[프로그래머스] 특정 문자열로 끝나는 가장 긴 부분 문자열 찾기 [프로그래머스] 특정 문자열로 끝나는 가장 긴 부분 문자열 찾기](http://t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png)
🧐 Review:
String 클래스의 lastIndexOf() 메서드는 부분 문자열이 문자열에서 마지막으로 등장을 시작하는 인덱스를 반환한다.
예를 들어,
![[프로그래머스] 특정 문자열로 끝나는 가장 긴 부분 문자열 찾기 [프로그래머스] 특정 문자열로 끝나는 가장 긴 부분 문자열 찾기](http://t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png)
위 코드에서 출력값은 "dE"가 시작되는 인덱스인 3이 출력된다.
🏷️ Reference:
String (Java SE 11 & JDK 11 )
Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by this String object is compared lexicographically to the character sequence represented by the argum...
docs.oracle.com
'알고리즘 문제 풀이: 자바 > Programmers' 카테고리의 다른 글
[프로그래머스] 정수를 나선형으로 배치하기 (0) | 2024.01.06 |
---|---|
[프로그래머스] 그림 확대 (0) | 2024.01.05 |
[프로그래머스] 전국 대회 선발 고사 (0) | 2024.01.05 |
댓글