笔记: python if not 判断是否为None的情况 if not x if x is None if not x is None if x is not None`是最好的写法,清晰,不会出现错误,以后坚持使用这种写法. 使用if not x这种写法的前提是:必须清楚x等于None, False, 空字符串"", 0, 空列表[], 空字典{}, 空元组()时对你的判断没有影响才行 链接:https://www.cnblogs.com/chenya/p/4218761.…
题目链接: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…
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","flow","flight"] Output: "fl" Exa…
题目 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 "". Example1: Input:["flower","flow","flight"] Output:"fl"…
公众号:爱写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"…
1. 题目 1.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 "". 1.2 中文题目 编写一个函数来查找字符串数组中的最长公共前缀. 如果不存在公共前缀,返回空字符串 "". 1.3输入输出 输入 输出 strs = […