两种方法: 先sort,再找。time complexity: O(nlogn)如果用array记录次数,space complexity是O(n)。如果只用int来记录current length以及longest length, space complexity 是O(1) 用hashset。T ...
分类:
其他好文 时间:
2018-11-10 15:29:52
阅读次数:
116
Sliding window Hashset Loop through every element inside the string. If the current char is not inside the hashset, push the char into the hashset and ...
分类:
其他好文 时间:
2018-11-10 15:04:19
阅读次数:
189
重新梳理了下基于net webapi 搭建restful api,也重新翻查了一些资料: RESTful API 设计最佳实践 https://www.zcfy.cc/article/restful-api-design-best-practices-in-a-nutshell 查询(Query)分 ...
HashMap 的死循环问题在网上层出不穷,没想到还真被我遇到了。现在要满足这个条件还是挺少见的,比如 1.8 以下的 JDK 这一条可能大多数人就碰不到,正好又证实了一次墨菲定律。
分类:
其他好文 时间:
2018-11-09 17:43:02
阅读次数:
160
ArrayList LinkedList TreeSet HashSet TreeMap Map接口内部定义了一个接口Entry HashMap {lishi=1996-8, zhangshan=jingsp, zhaoliu=overS, wangwu=960515} entryset =hash ...
分类:
其他好文 时间:
2018-11-05 19:08:04
阅读次数:
130
***************************Set********************************************* 类似数学中的集合 迭代顺序相关 排序相关的 Set(接口) HashSet(实现类) 1.去重 2.没有迭代顺序 SortedSet(接口) Lin ...
分类:
编程语言 时间:
2018-11-05 01:14:32
阅读次数:
160
Iteratable: Iteratable接口提供了iterator()方法。 Collection接口继承了Iteratable,由实现Collection的ArrayList、Hashset等来实现方法。 Iterator: Iterator接口在ArrayList、LinkedList等类中 ...
分类:
其他好文 时间:
2018-11-05 00:08:31
阅读次数:
189
问答题 1.怎样实例化一个Calendar对象? Calendar ca=Calendar.getInstance(); 2.Calendar对象调用set(1949,9,1)设置的年月日分别是多少? 就是1949,9,1 3.怎样得到一个1—100的随机数? 4.有集合{1,2,3,4}和集合{1 ...
分类:
编程语言 时间:
2018-11-04 11:09:49
阅读次数:
284
namespace ConsoleApp1 { class Program { static void Main(string[] args) { var list = new HashSet(101); for (int i = 0; i { ... ...
分类:
数据库 时间:
2018-11-03 21:08:05
阅读次数:
333
public class Solution { public int lengthOfLongestSubstring(String s) { int n = s.length(); Set set = new HashSet(); int ans = 0, i = 0, j = 0; while ...
分类:
其他好文 时间:
2018-11-02 00:13:24
阅读次数:
104