
微软面试100题
lvjun93
这个作者很懒,什么都没留下…
展开
-
微软面试100题-4.在二元树中找出和为某一值的所有路径
题目:在二元树中找出和为某一值的所有路径输入一个整数和一棵二元树(二叉搜索树)。从树的根结点开始往下访问一直到叶结点所经过的所有结点形成一条路径。打印出 和 与 输入整数相等的所有路径。例如输入整数22 和如下二元树10/ \5 12/ \4 7则打印出两条路径:10, 12 和10, 5, 7。思路:1、当访问到某一节点时,把该结点的值 添加原创 2013-01-17 20:24:05 · 681 阅读 · 0 评论 -
leetcode题整理
mergeTwoLists 合并有序链表/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {pu...原创 2019-07-23 14:10:25 · 164 阅读 · 0 评论 -
【39】给定一个无重的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复
#encoding=utf8#'''给定一个无重复元素的数组candidates和一个目标数target,找出candidates中所有可以使数字和为target的组合。candidates中的数字可以无限制重复被选取。说明:所有数字(包括target)都是正整数。解集不能包含重复的组合。示例1:输入: candidates = [2,3,6,7]...原创 2019-08-01 16:13:12 · 3040 阅读 · 1 评论 -
二刷整理
547,朋友圈,并查集,核心解根的父节点问题。https://leetcode-cn.com/problems/friend-circles/submissions/class Solution: def findCircleNum(self, M: List[List[int]]) -> int: #盲写 class UnionFin...原创 2019-08-26 16:34:50 · 223 阅读 · 1 评论