Skip to content

Instantly share code, notes, and snippets.

View LinyinWu's full-sized avatar

Linyin Wu LinyinWu

View GitHub Profile
/*
【解题思路】
1.使用static variable存count, 然后recursive调用函数。
【时间复杂度】
1.O(n)
【空间复杂度】
1.O(n)
/*
【解题思路】
1.考虑只有大写字母,用一个flag来保存字符是否出现.此时要考虑空白键,当成第27个字符。
2.考虑所有字符,用HashSet()。
3.不用Buffer,用两个指针iterate。
【时间复杂度】
1.O(n)
2.O(n)
3.O(n^2)
【空间复杂度】
/*
【解题思路】
不考虑空白,区分大小写,创建一个256的数组来储存第一个字符串里的字符, 再对第二个字符串遍历看是否一样。
【时间复杂度】
O(n)
【空间复杂度】
O(1)
【gist link]
https://gist.github.com/LinyinWu/deddefd0cb379783e61b
【test case】
@LinyinWu
LinyinWu / 1.2.c
Last active August 29, 2015 14:18
/*【解题思路】
c语言,char指针来对字符串进行操作,先找到尾指针,然后前后in place交换。
【时间复杂度】
O(N)
【空间复杂度】
O(1)
【gist link】
https://gist.github.com/LinyinWu/a8fc47eef2993e3bc749
【test】
hello
@LinyinWu
LinyinWu / 1.1.java
Last active August 29, 2015 14:18
ctci
/*
【解题思路】
1.考虑只有ASICC码,建立一个长度256的boolean数组.
2.扫描字符串,得到字符的ASIC码的值,此值为index,查看boolean数组,如果true返回false,不是true就设为true.
【时间复杂度】
O(n)
【空间复杂度】
O(1)
【gist link】 Java
https://gist.github.com/LinyinWu/3a9634d00595de30aca5