题目链接:https://leetcode.com/problems/longest-common-prefix/?tab=Description Problem: 找出给定的string数组中最长公共前缀 由于是找前缀,因此调用indexOf函数应当返回0(如果该字符子串为字符串的前缀时),如果不是则返回-1 Return: the index of the first occurrence of the specified substring, or -1 if there is n…
公众号:爱写bug 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 "". 编写一个函数来查找字符串数组中的最长公共前缀. 如果不存在公共前缀,返回空字符串 "". Example 1: Input: ["flower"…