Problem Β· Math

Arrange Coins 🐟

Learn this problem
● EasyAlarmINTERNOA

Problem statement

Given an array of integers coins, where each element represents the number of coins. For each number of coins, output the maximum number of rows that can be stacked, with the stacking rule being: the first row contains one coin, the second row contains two coins, and so on.

Function

arrangeCoins(coins: int[]) β†’ int[]

Examples

Example 1

coins = [3, 4, 6]return = [2, 2, 3]
No explanation for now..

More Alarm problems

drafts saved locally
public int[] arrangeCoins(int[] coins) {
    // write your code here
}
coins[3, 4, 6]
expected[2, 2, 3]
checking account