-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[leetcode-2119] A Number After a Double Reversal
Signed-off-by: carlos <carlos.wei.hk@gmail.com> Change-Id: Ifc338c845096339549cc7427716af9f3459fae63
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
c_programming/common/n19_a_number_after_a_double_reversal_2119.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <stdbool.h> | ||
#include <assert.h> | ||
#include "utils.h" | ||
|
||
bool is_same_after_reversals(int32_t num) | ||
{ | ||
return (num % 10 != 0) || (num < 9); | ||
} | ||
|
||
int32_t main(void) | ||
{ | ||
bool ret = false; | ||
|
||
ret = is_same_after_reversals(526); | ||
assert(ret == true); | ||
|
||
ret = is_same_after_reversals(1800); | ||
assert(ret == false); | ||
|
||
ret = is_same_after_reversals(0); | ||
assert(ret == true); | ||
|
||
LOG("All tests have passed!\n"); | ||
|
||
finish: | ||
return 0; | ||
} |