Home > OS >  Ratiorg got statues of different sizes as a present from CodeMaster for his birthday, usnig dart
Ratiorg got statues of different sizes as a present from CodeMaster for his birthday, usnig dart

Time:12-01

Example

`For statues = [6, 2, 3, 8], the output should be
solution(statues) = 3.

Ratiorg needs statues of sizes 4, 5 and 7.`

Input/Output

[execution time limit] 4 seconds (js)

[input] array.integer statues

An array of distinct non-negative integers.

Guaranteed constraints: 1 ≤ statues.length ≤ 10, 0 ≤ statues[i] ≤ 20.

[output] integer

The minimal number of statues that need to be added to existing statues such that it contains every integer size from an interval [L, R] (for some L, R) and no other sizes

I want to solve my question using dart flutter

CodePudding user response:

you can try this code i had solved this program on codesignal.

int solution(List<int> statues) {
statues.sort((a, b) =>{ return a-b });
return statues;
}

above is the dart code you can try it

  • Related