首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
兑换零钱(二)
[编程题]兑换零钱(二)
热度指数:2348
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 256M,其他语言512M
算法知识视频讲解
给定一个整数数组 nums 表示不同数额的硬币和一个正整数 target 表示总金额,请你计算并返回可以凑出总金额的的组合数。如果凑不出 target 则返回 0。
数据范围:数组长度满足
,数组中的数和 target 大小满足
示例1
输入
5,[1,2,4,5]
输出
5
示例2
输入
5,[4]
输出
0
示例3
输入
5,[5]
输出
1
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(0)
邀请回答
收藏(76)
分享
纠错
提交结果有问题?
0个回答
9篇题解
添加回答
这道题你会答吗?花几分钟告诉大家答案吧!
提交观点
问题信息
动态规划
数组
难度:
0条回答
76收藏
1607浏览
热门推荐
通过挑战的用户
查看代码
已注销
2023-03-05 10:55:00
牛客59979...
2022-11-04 14:00:14
JhaStinger
2022-09-25 23:09:02
盛夏的泡沫
2022-09-16 12:57:20
ekile
2022-09-14 13:08:39
相关试题
属于组合逻辑电路是()。
数字电路
评论
(1)
有同事不完成任务,影响力进度,你怎...
业务综合
评论
(1)
如果通过这次面试我们单位录用了你,...
岗位认知
自我认知
评论
(1)
请你说说Java的特点和优点,为什...
Java
评论
(267)
你身边有哪些人还没有使用滴滴,你认...
用户研究
评论
(1)
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型一维数组 * @return int整型 */ public int change (int target, int[] nums) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型vector * @return int整型 */ int change(int target, vector
& nums) { // write code here } };
#coding:utf-8 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param target int整型 # @param nums int整型一维数组 # @return int整型 # class Solution: def change(self , target , nums ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型一维数组 * @return int整型 */ public int change (int target, List
nums) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型一维数组 * @return int整型 */ function change( target , nums ) { // write code here } module.exports = { change : change };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param target int整型 # @param nums int整型一维数组 # @return int整型 # class Solution: def change(self , target: int, nums: List[int]) -> int: # write code here
package main import "fmt" /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型一维数组 * @return int整型 */ func change( target int , nums []int ) int { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型一维数组 * @param numsLen int nums数组长度 * @return int整型 */ int change(int target, int* nums, int numsLen ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param target int整型 # @param nums int整型一维数组 # @return int整型 # class Solution def change(target, nums) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型一维数组 * @return int整型 */ def change(target: Int,nums: Array[Int]): Int = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型一维数组 * @return int整型 */ fun change(target: Int,nums: IntArray): Int { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型一维数组 * @return int整型 */ public int change (int target, int[] nums) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型一维数组 * @return int整型 */ export function change(target: number, nums: number[]): number { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型一维数组 * @return int整型 */ func change ( _ target: Int, _ nums: [Int]) -> Int { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param target int整型 * @param nums int整型一维数组 * @return int整型 */ pub fn change(&self, target: i32, nums: Vec
) -> i32 { // write code here } }
5,[1,2,4,5]
5
5,[4]
0
5,[5]
1