Categories > Coding > C# >
[CHALLENGE] Make a function that finds how many time a substring is in a string
Posted
You gotta do it in C#.
You also have to use my template: https://github.com/rblxploit/ChecksubstrTemplate
There is more info on that github but basically, it has to not heavily rely on some method already in C# like the substring method. Do not give your submission here, i do not want anyone to cheat. The challenge is gonna finish Friday at 23:59 EST.
Link for submitting your code: https://docs.google.com/forms/d/e/1FAIpQLSfrYFEVNk0_NBDclbAPj6zJ973QlzjBGp1u2P3M3GJUyhqoUA/viewform?usp=sf_link
You just need to submit the function, please do not submit the other stuff in the code. Also, there is the time mode on the template that let's you test the time if it calls the function a million times syncronously. Try to make it as short as possible. I'll also test it myself because that time depends on the power of your computer. For me, it runs like 18 secs (22 on battery for some reason).
The README (on GitHub):
Template for the checksubstr challenge
This is the template for the easy level challenge i made on the WRD forums. This challenge is level easy. It is inspired of some homework that my dad was explaining to a student. What do do: Make a function that checks if a string is present in a substring
Where to work: the checksubstr function.
It is a function that takes in argument str (the string) and substr (the substring to check how many times in the string)
It has to return an integer which is how many times the substring is present in the string
Return -2 if the substring is empty.
Rules
- Make it using this template. It has to be in C#. This code should work in .NET Framework, .NET Core or Mono
- It has to be your own code
- You should not rely heavily on some method already in C#. For example, do not use the substring method already included in C#
For me to verify, you have to send it. I will show all the codes from everybody when the limit date is finished. It has to be the function only (checksubstr), not the rest of the code that i wrote. Do not give any executable file. Also, do not use obfuscation. If you use some obfuscator or make your code hard to read by accident, without knowing it or by purpose, i will not even bother reading your code.
What you should try to do
- Make it as fast as possible
- Write it in beautiful code
- Make it easy to understand
- Search less things on the internet as possible. It is ok if you search for one thing but try to do it the least possible
- Last but not least, it has to work properly
My new discord is Wabz#1337 with ID 777154062789509130
Replied
I already won this bois
6 seconds for 10,000 loops
Cancel
Post
Was on WRD front page
Programs I own - Synapse X, Protosmasher, Sirhurt, Sweat Heart of Sigma Chi, Scriptware V2
Languages I know - C#,JS,Lua,VB.net
Learning - Python, C
Replied
@AIpha It's actually for a million lol. Yes you won. Your program is 300% faster than mine.
Cancel
Post
My new discord is Wabz#1337 with ID 777154062789509130
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post