My LeetCode grinding. Trying to do a problem a day.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123456789101112131415 |
- #include <stdio.h>
-
- int arrangeCoins(int n){
- int count = 0;
- while (n >= count + 1) {
- n -= ++count;
- }
- return count;
- }
-
- int main() {
- printf("Expected: 3\n");
- printf("Got: %d\n", arrangeCoins(8));
- return 0;
- }
|