![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 67
superli90
这个作者很懒,什么都没留下…
展开
-
【Leetcode】Median of Two Sorted Arrays
转化成通用的寻找最K小元素 public class Solution { //还有log(min(m,n))的解法 public double findMedianSortedArrays(int[] nums1, int[] nums2) { int m = nums1.length, n = nums2.length; if ((n +原创 2015-08-26 11:25:17 · 259 阅读 · 0 评论 -
Wildcard Matching
非常巧的一个解法,记录一下 public class Solution { public boolean isMatch(String str, String pattern) { //非常巧 int s = 0, p = 0, match = 0, starIdx = -1; while (s < str.leng原创 2015-08-16 20:10:55 · 308 阅读 · 0 评论 -
线索化中序、先序、后序遍历二叉树的方式(待补充完整)
线索化遍历优点在于不需要递归和栈,空间复杂度降到O(1),且时间复杂度仍未O(n)。 期间会暂时修改树的数据结构,遍历结束后恢复。 线索化中序遍历二叉树 public void morrisTraversal(TreeNode root){ TreeNode temp = null; while(root!=null){ if(原创 2015-09-16 20:31:38 · 628 阅读 · 0 评论