My LeetCode grinding. Trying to do a problem a day.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

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. }