leetcode - 3Sum Closest (kSum Closest)
2015-06-05 22:06
453 查看
Sum ClosestGiven an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input
would have exactly one solution.
时间复杂度 O(n^k)
时间复杂度O(n^k-1)
would have exactly one solution.
For example, given array S = {-1 2 1 -4}, and target = 1. The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).
时间复杂度 O(n^k)
时间复杂度O(n^k-1)
相关文章推荐
- 内核中的中断函数request_irq()
- LeetCode:Reverse words in a String
- 第12章 异常处理
- [FZYZOJ 1247] RP堆
- Java知多少(83)面板基础:JPanel和JScrollPane
- Aspose Cells如何进行数据验证(后附下载地址)
- 黑马程序员_@protocol 协议
- Android 后台Service : 向服务器发送心跳包
- 利用钥匙串,在应用里保存用户密码的方法
- 随机数 作业
- php本地文件上传到远程服务器
- 线程间通讯和等待唤醒机制
- 设置linux静态IP
- Preparing Olympiad
- Linux 压缩与解压缩相关
- 《软件调试艺术》读后感二
- 两种方法将oracle数据库中的一张表的数据导入到另外一个oracle数据库中
- VS2013Z学习java插件
- poj 3468 A Simple Problem with Integers(线段树区间更新)
- MacOS copy图标shell脚本