Notice
Recent Posts
Recent Comments
Link
목록LeetCode (1)
티라미수 코딩생활

문제 Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Input: strs = ["flower","flow","flight"] Output: "fl" class Solution { fun longestCommonPrefix(strs: Array): String { } } 처음에 prefix 라는 단어를 놓쳐서 문제를 보자마자 기겁했었습니다. 전 배열에 공통적으로 포함되어 있는 (자리가 상관없는) String 중 가장 긴 거 찾기 인 줄 알았습니다.. 다행히 시작 위치는 앞에서부터 고정입니다. 나의 ..
코딩테스트 & 자료구조
2022. 12. 6. 18:07