diff options
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 |
