diff options
| author | Mistivia <i@mistivia.com> | 2025-09-01 21:52:38 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-09-01 21:52:38 +0800 |
| commit | 856f16f5d1ebbbaed25e89980a3401ea19e6d5ee (patch) | |
| tree | 9301c0840a5cb11a1f576d2eed5667a109a71eb2 /c | |
| parent | 19b55c0d3cec78ae26aed8b7d4a51a1e71a32a99 (diff) | |
solve 58
Diffstat (limited to 'c')
| -rw-r--r-- | c/0027/main.c | 3 | ||||
| -rw-r--r-- | c/0035/main.c | 3 | ||||
| -rw-r--r-- | c/0058/main.c | 21 |
3 files changed, 27 insertions, 0 deletions
diff --git a/c/0027/main.c b/c/0027/main.c new file mode 100644 index 0000000..cc104bb --- /dev/null +++ b/c/0027/main.c @@ -0,0 +1,3 @@ +int removeElement(int* nums, int numsSize, int val) { + +}
\ No newline at end of file diff --git a/c/0035/main.c b/c/0035/main.c new file mode 100644 index 0000000..253187b --- /dev/null +++ b/c/0035/main.c @@ -0,0 +1,3 @@ +int searchInsert(int* nums, int numsSize, int target) { + +}
\ No newline at end of file diff --git a/c/0058/main.c b/c/0058/main.c new file mode 100644 index 0000000..6aff206 --- /dev/null +++ b/c/0058/main.c @@ -0,0 +1,21 @@ +int lengthOfLastWord(char* s) { + int i = 0; + int cur = 0; + int last = 0; + while (s[i] != '\0') { + if (s[i] == ' ') { + if (cur > 0) { + last = cur; + } + cur = 0; + } else { + cur++; + } + i++; + } + if (cur > 0) { + return cur; + } else { + return last; + } +}
\ No newline at end of file |
