You are given the root of a binary tree with n nodes where each node in the tree has node.val coins and there are n coins total. In one move, we ...
You have a total of n coins that you want to form in a staircase shape, where every k th row must have exactly k coins. Given n, find the total number of full staircase rows that can be formed. n is ...
2016-11-03 12:22 0 7416 推荐指数:
You are given the root of a binary tree with n nodes where each node in the tree has node.val coins and there are n coins total. In one move, we ...
There are n coins with different value in a line. Two players take turns to take one or two coins from left side until there are no more ...
There are n coins in a line. Two players take turns to take one or two coins from right side until there are no more coins left. The player ...
题目 硬币排成线 II 有 n 个不同价值的硬币排成一条线。两个参赛者轮流从左边依次拿走 1 或 2 个硬币,直到没有硬币为止。计算两个人分别拿到的硬币总价值,价值高的人获胜。 请判定 第一个玩家 是输还是赢? 样例 给定数组 A = [1,2,2 ...
Given an array A (index starts at 1) consisting of N integers: A1, A2, ..., AN and an integer B. ...
给定不同面额的硬币 coins 和一个总金额 amount。编写一个函数来计算可以凑成总金额所需的最少的硬币个数。如果没有任何一种硬币组合能组成总金额,返回 -1。 示例 1: 输入: coins = [1, 2, 5], amount = 11 输出 ...
You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up ...
Medium! 题目描述: 给出集合 [1,2,3,…,n],其所有元素共有 n! 种排列。 按大小顺序列出所有排列情况,并一一标记,当 n = 3 时, 所有排列如下: "123" "132" "213" "231" "312" "321 ...