码迷,mamicode.com
首页 > 其他好文 > 详细

90 k数和 II

时间:2018-07-16 20:29:03      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:show   style   type   wrap   dfs   过程   ntc   post   href   

原题网址:https://www.lintcode.com/problem/k-sum-ii/description

描述

Given n unique integers, number k (1<=k<=n) and target.

Find all possible k integers where their sum is target.

您在真实的面试中是否遇到过这个题?  

样例

给出[1,2,3,4],k=2, target=5,返回 [[1,4],[2,3]]

 

 

标签
LintCode 版权所有
Depth-first Search(DFS)
 
 
思路:深度优先搜索(DFS是一个递归的过程)
 
 
 
参考:
 

 

90 k数和 II

标签:show   style   type   wrap   dfs   过程   ntc   post   href   

原文地址:https://www.cnblogs.com/Tang-tangt/p/9319849.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!