aboutsummaryrefslogtreecommitdiff
path: root/remove_substring.c
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2025-02-10 18:17:20 -0700
committerJack Sangdahl <[email protected]>2025-02-10 18:17:20 -0700
commitebefd1aafb68dcfec333ba24826884d029b40856 (patch)
tree7de07c7ffd729234c2b80f6213f51895ef3aa37b /remove_substring.c
parente1eadeafa56ea84d76a484de1c2dae912b9ec772 (diff)
downloadleetcode-ebefd1aafb68dcfec333ba24826884d029b40856.tar.gz
leetcode-ebefd1aafb68dcfec333ba24826884d029b40856.zip
1910. remove all occurences of a substring
Diffstat (limited to 'remove_substring.c')
-rw-r--r--remove_substring.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/remove_substring.c b/remove_substring.c
index 7a7aa38..45c6fa3 100644
--- a/remove_substring.c
+++ b/remove_substring.c
@@ -1,7 +1,5 @@
// 1910. Remove All Occurrences of a Substring
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "leetcode.h"
/*
* given two strings 's' and 'part', perform the following operation on 's'
@@ -24,8 +22,8 @@ char *removeOccurrences(char *s, char *part) {
}
int main() {
- char s1[] = {"daabcbaabcbc"}, p1[] = {"abc"};
- char s2[] = {"axxxxyyyyb"}, p2[] = {"xy"};
+ char *s1 = "daabcbaabcbc", *p1 = "abc";
+ char *s2 = "axxxxyyyyb", *p2 = "xy";
printf("%s\n", removeOccurrences(s1, p1)); // expect: dab
printf("%s\n", removeOccurrences(s2, p2)); // expect: ab
}