Coding challenge Day-6
Fizz Buzz Multithreaded
This task was so crazy for me because once again I had to make use of Python(I Got frustrated at some point and I even attempted C++. ). It was the famous FizzBuzz challenge but this time it was multithreaded(A word I didn't get a grasp of till today). When I saw the question I knew I had to do a lot of research for it(No shame in that.)
Thought process
Truth be told from the start I was blank on what to do. After some minutes I then started to see the question clearly. Some of the thoughts were:
- Count through the input number from 1 to the input number
input=15 //[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
- During the counting, replace certain numbers with either
fizz, buzz or fizzbuzz
based on the conditions given in the question.
It was simple at that point in my head but the fact that I can't use JavaScript kept me bothered. Let's see how I approached it though.
Implementation
My first attempt at using Python failed and it was because I didn't pay attention to the fact that it was multithread.
For the second attempt, I tried to import Lock and use but the code exceeded the time limit.
For the third attempt, I used C++ but had compilation issues.
It was after the third attempt, I decided to use Python threading.Conditon()
to set a condition that orders the firing of threads sequentially. I had to do a lot of research to get hold of this method and it worked out!
What I learnt.
I was able to learn about multithread programming a little bit. Also, I was able to use my second choice programming language again(Planning to go back and refresh my knowledge on it more)
Conclusion
Today's task definitely stressed me but in the end, my code was accepted when I submitted it with a memory usage of 13.7MB with a runtime of 51 ms
Thank you for reading through!
Day six(6) done, four(4) more days to go!
You can follow me on Twitter
Subscribe to my newsletter
Read articles from Ameh Elijah Uma-Ojo directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Ameh Elijah Uma-Ojo
Ameh Elijah Uma-Ojo
I'm a talented frontend developer with expertise in JavaScript, React, Tailwind, Firebase and a lot of other technologies. With a passion for creating intuitive user interfaces and seamless user experiences, I specialize in building modern web applications that are both beautiful and functional. In addition to my development skills, I'm also interested in technical writing. I enjoy sharing their knowledge with others and have a talent for explaining complex technical concepts in a clear and concise manner. When not coding or writing, I enjoy keeping up with the latest trends and advancements in technology. I'm always looking for new and innovative ways to improve my skills and stay on the cutting edge of the industry. Overall, I'm a versatile and driven professional with a bright future in both frontend development and technical writing.