摘要:
第一种算法,不需要任何排序的暴力算法,一个字符一个字符,一个字符串一个字符串去比较,时间复杂度O(m*n), m是数组长度,n是最短字符串的长度。 public String longestCommonPrefix(String[] strs) { StringBuilder res = new S 阅读全文
posted @ 2022-01-25 06:58
阳光明媚的菲越
阅读(35)
评论(0)
推荐(0)
摘要:
这道题是一道Graph题目,关于这种人际关系网,谁认识不认识谁的题目,用indegree,outdegree是没问题的,时间复杂度是O(n2): /* The knows API is defined in the parent class Relation. boolean knows(int a 阅读全文
posted @ 2022-01-25 03:22
阳光明媚的菲越
阅读(33)
评论(0)
推荐(0)
浙公网安备 33010602011771号