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.

main.c 241B

123456789101112131415
  1. #include <stdio.h>
  2. int arrangeCoins(int n){
  3. int count = 0;
  4. while (n >= count + 1) {
  5. n -= ++count;
  6. }
  7. return count;
  8. }
  9. int main() {
  10. printf("Expected: 3\n");
  11. printf("Got: %d\n", arrangeCoins(8));
  12. return 0;
  13. }