上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 22 下一页
摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedia: ... 阅读全文
posted @ 2015-07-12 14:44 Maydow 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 二叉树 在计算机科学中,二叉树是每个节点最多有两个子树的树结构。通常子树被称作“左子树”(left subtree)和“右子树”(right subtree)。二叉树常被用于实现二叉查找树和二叉堆。 二叉树的每个结点至多只有二棵子树(不存在度大于2的结点),二叉树的子树有左右之分,次序不能颠倒。二叉 阅读全文
posted @ 2015-07-12 13:56 Maydow 阅读(300) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list, determine if it is a palindrome.该题是判断一个链表是不是回文链表。思路一:将该链表反转,然后从头开始对比节点值,时间复杂度O(n),空间复杂度O(N)思路二:利用runner pointer。很多的题目都可以利用... 阅读全文
posted @ 2015-07-10 20:33 Maydow 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an... 阅读全文
posted @ 2015-07-09 21:42 Maydow 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is great... 阅读全文
posted @ 2015-07-09 21:11 Maydow 阅读(127) 评论(0) 推荐(0) 编辑
摘要: public ListNode deleteDuplicates(ListNode head) { if(head==null || head.next==null) return head; ListNode pre=head;; ... 阅读全文
posted @ 2015-07-09 20:21 Maydow 阅读(112) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文
posted @ 2015-07-09 19:20 Maydow 阅读(138) 评论(0) 推荐(0) 编辑
摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"tw... 阅读全文
posted @ 2015-07-08 19:51 Maydow 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 1、查找字符串中最长的重复子串 阅读全文
posted @ 2015-07-08 18:12 Maydow 阅读(182) 评论(0) 推荐(0) 编辑
摘要: Quest:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.合并两... 阅读全文
posted @ 2015-07-08 14:51 Maydow 阅读(201) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 22 下一页