November 2020

My Blog

Latest blog

How I Got almost 10,000 Reddit Karma in One Day  thecsengineer Saumya Ranjan Nayak

It was Sunday and a pretty normal day just chilling and I came across a meme that I felt was pretty hilarious and it was related to programming so, I shared it on an awesome Reddit community and had no idea that it would become one of the world's top 25 post on reddit and hit it's popular front page .

How it Happened ? :

So, this is how the story goes - so after laughing at the meme, I thought instead of just laughing alone, let's just post it on ProgrammerHumour, which is a very popular subreddit where people can share funny and humorous things or mainly memes related to programming and make other like minded people laugh too. 

And then I just got busy with some work of mine and when I checked after an hour or so it got around 100 upvotes which I expected and is pretty great too.

It Just Blew Up :

Then later after some time when I unlocked my phone , there were endless orange reddit icons on my notification bar .And then to my surprise it had crossed around 1000 upvotes and then it just did not stop and the post just blew up and around evening it got around 10,000 upvotes and hundreds of comments I guess and also people were kind and gave me some reddit awards which I had seen earlier in different popular posts but never thought of getting one . If you want to know more about awards you can go here.

And it just kept going on and as I write this blog ,wait let me check....WHOA !! it has 29,500 upvotes, and 91 awards and 298 great comments which is just insane .And this brings my reddit karma to 10,900 of which around 10,000 I gained just on that day itself  .

Why did this Happen  ? :

So, then I wondered why did this post become so popular and then when I read the comments and got to know that the context of the meme was so relatable and almost happens to us programmers everyday that people just loved it so much .

Lesson of The Day :

So, what we all must take from this event is that if we are able to produce content to which people will relate to then that's the real gem . For example many people find it a bad idea to speak about their failures either physically or on a video and just think that people just want to know how you are after succeeding but the real thing is we must share is this awesome process of failing over and over till some point where success is inevitable because people can RELATE to it and learn from our mistakes .

Well I got a bit philosophical there I guess but the gist is just that if you want people to like and engage with the content you create , then just be real because that's what everyone has gone through and thus can relate to it.

Thanks for bearing me this far !! πŸ˜€❤


Saumya Ranjan Nayak

πŸ‘ˆ Do Share πŸ‘‹

Most Efficient Algorithm to Find All the Prime Factors of a Number thecsengineer Saumya Ranjan Nayak

The Objective :

To find all the prime factors of a number most efficiently .

Let's assume the number of which we have to find all the factors is n.

Naive Approach :

So, basically what we have to do is that we have to find all such prime numbers that divide n completely or are factors of n.

So , at first the what strikes our mind is that we would just iterate from 2 to the square root of n, which basically is the whole set of numbers from which some may be the factors of n and then check if that number is prime and if it is then check whether it divides n and if it does we store it as a prime factor of the number n .

Efficient Approach :
Note : Let's keep in mind that every prime number is odd except 2 .
So, the steps that we can follow to optimize the algorithm is that :

 ✔️ First we make a while loop and check whether n is divisible by it and if it does then just keep dividing it until it isn't divisible any more or it becomes one , exactly like how we simply factorize by hand .
                              Most Efficient Algorithm to Find All the Prime Factors of a Number thecsengineer Saumya Ranjan Nayak

✔️ So, now we have already tested the number against the only even prime number 2. Now we know that all the prime numbers are odd so instead of traversing all the way upto the square root, we can just start from 3 which the next prime number and keep incrementing it by 2 (i=i+2) in every iteration so that we keep ending up with just odd numbers in every iteration  .So by just using this simple trick we just cut around half of the operation that would have happened if we would have taken all the even numbers into account as we had thought in our naive approach.

✔️ So by following the above steps we get store all the prime factors and at last our number n would be reduced to 1 due to all the divisions with its factors throughout the process , provided if the number is not prime . But if the number is prime no one would be able to divide it and so it itself is it's own prime factor . So , at last we can just perform a check that if n is greater than 1 then we store the n itself as the prime factor .

Enough of the talks lets now see it's implementation :

Taken from the Competitive Programming Repository Do give a star ! πŸŒŸ 

Thanks, Keep Learning 🧑

Do share your thoughts in the comments .

Saumya Ranjan Nayak

πŸ‘ˆ Do Share πŸ‘‹


My first Software TheCSEngineer Saumya Ranjan Nayak

     I had neither the plan of making a graphical software nor did I know how to but somehow I decided and I ended up doing it and I am going to share why I made this simple desktop software using Python and the Tkinter, that I named off the top of my mind - Productive Search .


So, recently since like ten days I became very distracted by Youtube not because it's bad rather because it's suggestion/recommendation algorithm is so good that whenever I was studying something and had to search it on YouTube and thus when I go to Youtube's homepage, there will definitely be someone I like to watch streaming or some awesome video that I just have to watch . 


So, yesterday I just thought that I don't want to go on youtube's homepage while studying and end up watching something else and instead of what I came for . And recently I found web scraping and automating with Python pretty interesting and thus I thought let's try and write a script that would automatically show me the search results of youtube for the thing I am searching for thus eliminating the process of opening the browser and going to the homepage .And thus making studying pretty minimalistic ,no recommendations and no distractions.

So , I googled stuff and here and there and was able to make it work .But then I thought wouldn't it be great if  I made a graphical user interface that would act like an on screen youtube search software, which I would keep open while studying and thus when I had to search something I could pass the text through the GUI to the underlying script and thus end up with the results on my browser .This seemed pretty clean and sounded like a plan and I went on with it . 


Software Using Tkinter and Python TheCSEngineer Saumya Ranjan Nayak

So, today after waking up today I decided to use Tkinter which is the standard Python interface and to the Tk GUI toolkit , thus basically it is Python based and can be used to make simple user interfaces . And instead of first going through an hour long tutorial or something which I would later forget (Tutorial Hell), I decided to go the classic developer way , google stuff , read a bunch of answers on Stack Overflow , apply and learn . Thus I sat from around 9 AM and I was done around 1-2 PM . 

So , this is what I created and though many of you may find it pretty simple but I am very proud of it as it is the first ever desktop software I made and which I once dreamt of :

youtube searching productivity Software Using Tkinter and Python TheCSEngineer Saumya Ranjan Nayak

To use it clone the Github Repository and there just run the .py file . Do give a star on Github, means a lot πŸŒŸπŸŒŸ.

Actually figuring out how to center things in Tkinter took a lot of time .And also my online classes were going on side which I obviously did mute. 

So, after making this I surely realized that this way of hacking , searching ,reading and creating stuff from scratch is the best way to learn new things and I would definitely suggest you to do it too and save a lot of time and not get stuck in tutorial hells like many.

Let's just never fear from learning something new and keep creating stuff. ✔️🧑


Saumya Ranjan Nayak

πŸ‘ˆ Do Share πŸ‘‹

Machine Learning thecsengineer saumya ranjan nayak

Hi, guys so I am very pumped today as I have decided that from tomorrow, I will be starting to learn Machine Learning which by the way if you had read the first ever Post of this blog  where I talk about my future goals, you must know that I am very passionate about it .

Starting To Learn New Stuff :

Usually when I am going to learn something new I have this kind of exciting and anxious period of a day before I start it where I just  think that, will I be able to do this or not ? and ML being the thing I always had in mind and the only thing I really want to dive deep into, well besides algorithms and competitive programming, I am just getting all the feelings now .

And maybe also because this is a completely new stream as compared to all our classical streams like Web Devs, Mobile Devs and our good old Software Engineering .

The Inspiration Behind :  
                                   Starting To Learn Machine Learning  thecsengineer saumya ranjan nayak
I still remember the first time ever I wanted to learn Machine Learning . So this how the story goes, one day I decided to watch a YouTube Originals series called The Age of AI ,honestly because on the thumbnail there was Robert Downey Jr. , and being a fan of Avengers and tech I just had to watch it . So, every episode was just very inspirational for me. But what struck me was, that smile on the faces of people who were going through various difficulties in their life. And a bunch of engineers and researchers got together and made something that brought up that smile and thus had a huge impact on their life. 
Then after some thinking I came to the conclusion that isn't it why we are here - to contribute as  much as possible to the life here on earth .
Then I just decided that someday I will definitely learn AI and master it as in my opinion of all the tech that we have on earth at this point AI is the most impactful and has the power to literally push the human race forward . This thought has just been with me since .

The Right Way To Learn :

So, from my experiences with learning new stuff, I have come to know one must not watch a lot of tutorials else one just gets trapped in the tutorial hell. 

So, I have decided to take complete hands on approach to learn it . And as I have decided to start learning ML early, as compared to what I had planned earlier so I have decided to start slowly and consistently daily just by reading a book, googling stuff and applying what it says. So ,I researched to know actually which one is the best book and I think I have found the perfect book for me and for every one who wants to get into the world of Machine Learning with a practical approach , so this book is called :

Hands-On Machine Learning with Scikit-Learn, Keras and Tensor Flow 
written by AurΓ©lien GΓ©ron and published by O'Reilly Media, Inc. 

Click below to know more about the book :

So , I have just made my mind that even on days where I don't want to study I will read at least 1 page instead of procrastinating pointlessly  .So the plan is just to be super-consistent and do it daily as this is the only way anyone can master anything . Ya and I am also sharpening my Python skills on HackerRank now .

Speaking of consistency I became 3 stars on CodeChef today after the November Long Challenge .Now the goal is to practice more and get comfortable in CodeForces B level question . Okay, let's get back to the topic at hand .

I am also thinking about documenting this process on my YouTube channel and just explaining what I learn and things that I find interesting .

So, I hope everything goes good and Thanks for Reading this far !!πŸ˜€πŸ§‘


Saumya Ranjan Nayak

πŸ‘ˆ Do Share πŸ‘‹


Power of Being Consistent in Computer Science and Life thecsengineer saumya ranjan nayak

The lockdown has been pretty long and  many of us have been learning new things , experimenting a lot and in the process learning a lot about about ourselves on both personal and professional level like I discovered that for some reason I don't like CSS  LOL . Jokes aside let's be serious now.

What is the Problem ? :

We have been setting goals and working towards achieving them . Some time getting in that zone or flow state and sometime procrastinating. Some time able to achieve the goals and some time not . 

In this process what I have noticed is that we sometimes take up very large goals and keep a small deadline and many times this type of decision is associated with the a tendency to get a satisfaction of achievement as early as possible . For example sometime I say to myself-"Okay , this contest is at 10 days later and within these 10 days I will solve 50-60 good problems and do well in the contest ." 

But what happens is that such goals are so unrealistic that we end up feeling burned out some days later . This is something like watching a 10 hour long tutorial maybe within 2 days and get that satisfaction of okay now I know this tech stack but turns out later that one just end up in a tutorial hell .

I think this is called Instant or Immediate or Short term gratification which is very bad and one should always stay away from this trap .

Here I have just related it the world of Computer Science but this is a very big thing top stay aware of in day to day life .For example watching that one more episode of Game of Thrones to get the that short term satisfaction while procrastinating on the problems that you had to solve. 


SanDisk Cruzer Blade 32GB USB Flash Drive

The Key :

So, what I have found out is that the key to stay away from this trap is the self-discipline to stay consistent bit by bit every day . 

It takes a lot of time to develop this discipline to be consistent especially while starting out but once it happens the habit just gets into the subconscious,  life just becomes smooth ,planned and you always know how you can achieve anything in life .

The Power of Being Consistent in Computer Science  thecsengineer saumya ranjan Nayak 


Realization :

So, I realized this when I made this goal of solving 100 problems on CodeForces and this just seems very much at first but what I did was broke it down to 2-3 problems at least everyday and the thing I want to mention here is that this would not have worked like every time other time if I hadn't written the number of goals on a white board in front of me which made me see it every day and the I just kept increasing the numbers slowly everyday and and at the end of around 45 days, this seemingly impossible task was done and writing that 100/100 on the whiteboard was a complete different thing .

Power of Being Consistent in Computer Science  thecsengineer saumya ranjan nayak

So, from my experience what  I would suggest any one trying to achieve a large goal is :

✔️ Take a paper write the Goal and start breaking it down into pieces which can be achieved every day easily .

✔️ Then write it somewhere where you easily see it every day , this will help you to never forget or ignore it  .

✔️ Be disciplined and calm enough to not procrastinate whatever happens and to just complete it before you call it a day and this also gives a different kind of  satisfaction knowing that it was a day you will be proud of .

Getting Inspired :

I know there are many real life examples of  people who made just because they were consistent no matter what like Elon when 3 of his  rockets crashed ,but its been some time and I am really into Chess and I want to mention an awesome person named Sagar Shah, who is the owner of ChessBase India and also maintains an YouTube channel which recently touched 500K subscribers and I was amazed to know that he had published around 300 videos when he had 800 subscribers . This is just gives me inspiration as I am too going to start uploading videos on YouTube on my channel Future Driven.

I mean this is level of consistency one needs to have and not to mention one needs to love a thing that much too else everything just fades away with time .

So, lets just keep doing what we love consistently and good things will happen and yes a very Happy Diwali !!   πŸŽ‡πŸͺ”πŸ§‘

Do comment and share your thoughts on it !!

thecsengineer saumya ranjan nayak programming blog computer science steve jobs

"Here's to the crazy ones the misfits, the rebels the round pegs in the square holes....the ones who see things differently - they are not fond of rules.....You can quote them ,disagree with them ,glorify them or vilify the, but the one thing you can't  do is ignore them....because they change things....they push the human race forward, and while some may think them as the crazy ones, we see genius , because the ones who are crazy enough to think that they can change the world, are the ones who do .
— Steve Jobs, 1997

        Since I came to know about Apple and saw a Macbook it always has always been a dream to get one of those . But I can't afford to spend that kind of money on just something I want to have, but I can definitely work hard on things I am passionate about and earn enough in the process to gift myself a macbook someday and that would be just so great .

Being a programmer I would also love to code on a mac and also edit videos for YouTube.

Learning from Steve :

Recently I also read Steve Job's biography by Walter Isaacson and it was just so inspiring . And I would definitely suggest it to anyone searching for some good books to read especially biography. He is a great example of the thing that if you want it then just go and grab it . And if you will read the book you will come to know that most of the devices that we use like our personal PCs , the laptop design, all are just Steve's imagination
.thecsengineer saumyaranjan nayak And this just fascinates me that every great thing we know today were just imagined by someone who just did not imagine rather went out put in the work and made it happen and not just keep thinking about it as most people do .

Some may think this is materialistic goal or something but this just a small goal of mine and I believe that I can achieve this and I definitely will. 
And moreover just this image or vision of me in mind buying myself a Mac is just so inspiring and uplifting in itself .

thecsengineer saumyaranjan nayak goals programming

So, what I did today is that I went to the Apple India website and made an Apple ID for first time to just you know to lay kind of a foundation  that someday I am going to come and buy and just look back at this day that I was so confident that I would achieve this checkpoint one day , and also that I also wrote a blog on it .

I just wanted to document this today for the future me . πŸ™‹‍♂️πŸ™‹‍♂️

Saumya Ranjan Nayak

πŸ‘ˆ Do Share πŸ‘‹

Hi, so I came across this beautiful C program which creates a rotating 3D donut which I found pretty fascinating and it's code is written by Andi Solan who is a Software engineer and has worked at Google , Spotify and many more which I came to know about from his site .

The MA-th-GIC behind it :

So, basically what these program does is , it plots the ASCII character on the pixels and it's based upon the math of 3D rendering objects and if you are into math and want to check out how does this thing work mathematically then you can go to this awesome blog post written by Andy himself explaining the math behind it .

Steps to Run the C Code :

Maybe you may face some error like the donut just endlessly keeps on printing when you run or something else but don't worry I got you covered .

So as I was trying to run the code and had to spend some time with Google to make this work perfectly because in some IDEs it is working and in some its not so here I am sharing the awesome code and how and where to make it run perfectly .

So, to see the rotating 3D donut on your screen :

1. Copy the above code onto this Online IDE.
2. Set the language to C maybe on the top right corner.
3. Click the Run button and enjoy the scene. 

I was just pretty excited about this and thought to share it with you all and maybe it inspires everyone to create something great .

Would love to know your thoughts . Do comment !! πŸ˜ƒπŸŽ‰

thecsengineer blog saumya ranjan nayak

Competitive Programming Progress :

Been participating in CodeForces contests consistently since some time and may be I will leave a picture of my graph below . 
Thus got frustrated a lot at first by not being able to solve some easier slightly tricky problems like even the A level problem . But slowly learning to stay calm and focused in such situations as logically this is the only way to reach a solution and not by getting sad or mad .

thecsengineer blog computer science , competitive programming

So, after solving the second A2OJ ladder which has 100 problems now I am confident on solving A  and now I am working on solving B. A2OJ is a great source for practicing problems do try it out .
Ya that's it .

And lately since 3 to 4 days feeling kind of distracted and thus haven't been productive , so maybe I need to kind of reboot myself from tomorrow and practice well . 

Catching up with College : 

I also have to catchup on the College subjects like Probabililty and Linear Algebra which I am very interested in and very lucky to have those in my curriculum this semester as these are a prerequisite for Machine Learning .

About the Google Kickstart :

The upcoming KickStart Round H is on Novemeber 15th which I am pretty excited about . In the last contest I managed to solve 2 problems out of 4 and got a rank of 4000-ish out out approx. 8000 participants and this has been my best performance yet in the Google Kickstart . This is my first year of participating in Kickstart Rounds which if you don't know happens  throughout the year in different months and I love it . The goal is to solve the C problem this time - Fingers crossed 🀞🀞. 
Getting those green ticks is the best feeling ever✔️✔️ .Competitive Programmers will know .

The thing is that everyday, one has the choice to either do something that makes one ordinary or extraordinary .

The goal is just have a positive and calm mindset so that I always choose the right decision and not the easy one and just make myself proud as I look back at the day after some time .

On that note I have decided that starting today every will either publish a video on my YouTube channel or write a blog here .

After all consistency and work wins above all . 

Contact Me

Contact With Me