![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
文章平均质量分 63
繁华落尽梦一场-
这个作者很懒,什么都没留下…
展开
-
[LeetCode] Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element原创 2015-04-29 17:11:46 · 332 阅读 · 0 评论 -
[LeetCode] Path Sum 求二叉树中满足要求的路径
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum原创 2015-04-27 17:24:32 · 572 阅读 · 0 评论 -
[LeetCode] 判断两个链表是否有公共节点并返回第一个公共节点
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘原创 2015-04-27 15:02:01 · 2034 阅读 · 0 评论 -
[LeetCode] Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.题目大概意思是说求二叉树的最小深度,原创 2015-04-27 17:48:39 · 344 阅读 · 0 评论 -
总结:和链表有关面试题
面试中被问链表的题目我就不再多说,直接总结题目。1、将链表逆序这个问题很早就研究过,但后来一次面试的时候我突然紧张忘了,没答上来。我不知道大家的解法是什么,我的解法是遍历链表是用前插发插入节点,最后的链表就是逆序的。class ListNode: def __init__(self, x): self.val = x self.next =原创 2015-04-30 15:19:27 · 424 阅读 · 0 评论 -
[LeetCode] Symmetric Tree 判断二叉树是否为对称二叉树
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the f原创 2015-04-28 10:10:25 · 577 阅读 · 0 评论 -
[LeetCode] Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20原创 2015-04-28 14:49:20 · 416 阅读 · 0 评论 -
[LeetCode] Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe原创 2015-05-04 10:09:38 · 376 阅读 · 0 评论 -
[LeetCode] Find Minimum in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists in the ar原创 2015-05-04 12:21:29 · 430 阅读 · 0 评论