Code your way through Competitive programming!

If you’re wondering how to be an ace programmer, then one of the best ways to do so is through competitive programming. Topcoder, Hackerearth, SPOJ, etc all must ring a bell, these are sites that provide high-quality problems to you that are a little difficult to crack. Competitive programming needs a slightly different approach than regular programming.

How is competitive programming different from normal programming?

I got this excerpt from a popular Quora answer which could answer it best:

Answer for: How is competitive programming different from normal programming?

This basically tells us that in developmental programming, we need to write an efficient code. However, competitive programming requires a code which “just works” with the given conditions.

So, what exactly do you need to “kill the lion” in 2 minutes?

  • You need to know the basics of a language, pick any, C++ or Java, whichever you’re comfortable with.
  • Pick an online judge. Some popular ones are: topcoderSPOJcodechef and hackerearth.
  • Start with simple problems such as Div 2, 250
  • Practice these problems thoroughly such that you earn around 240 points a day.

Sounds easy? Well, for those of you who have tried a hand at it must know that TERMS like TLE(Time limit exceed), MLE(memory level exceed) and WA(Wrong answer)  are so good at giving NIGHTMARES!

How to be a Ninja Competitive programmer?

To gain crazy ninja skills at competitive programming, one needs to have a grasp of a few specific topics.

Topics mostly covered in contests are:

  1. Graph algorithms: Breadth first search (BFS), Depth first search(DFS), Strongly connected components (SCC), Dijkstra, Floyd-Warshall, Minimum spanning tree(MST), and Topological sort.
  2. Dynamic programming: Standard dynamic programming problems such as Rod Cutting, Knapsack, Matrix chain multiplication, etc
  3. Number theory: Modular arithmetic, Fermat’s theorem, Chinese remainder theorem(CRT), Euclidean method for GCD, Logarithmic Exponentiation, Sieve of Eratosthenes, and Euler’s totient function
  4. Greedy: Standard problems such as Activity selection
  5. Search techniques: Binary search, Ternary search, and Meet in the middle
  6. Data structures (Advanced): Trie, Segment trees, Fenwick tree or Binary indexed tree(BIT)
  7. Bitmasking
  8. Game theory: Basic principles of Nim game, Grundy numbers, and Sprague-Grundy theorem

Our newest online course Eminence indulges in all of these so-called tricky topics just so that can ace that programming contest in just three months.  Eminence will be taken up by Ankush Singla who has a Bachelor’s degree in CS from IIT Delhi and Masters in Computer Science from Stanford University; and Parikh Jain, the “ninja” of competitive coding who holds a degree in CS from Delhi Technological University (DTU). Register now to book yourself a seat in a course that will brush up your competitive skills to a whole new level. 


Tips and tricks to gear up for this placement season

It’s interview season and it’s crunch time! With the placement season a month away, the panic mode is on and a lot of you will be sitting for your placement and for internships this time.

Most companies look for students having past experience in various internships and building projects. The kind of exposure that gives is difficult to attain inside a classroom. If you don’t have that, don’t fret too much! Campus interviews can be intimidating and you’d be sitting for the first time so don’t let the anxiety get the better out of you. Here are some tips and tricks to stay ahead of the pack and crack your tech interviews!

1.Ace that written exam:

Most companies start with a minor written exam or programming test before moving on to the interview part. Though this part is underestimated but needs a whole lot of attention from you. Start getting a headstart at this by practising a whole lot of questions. Take mocks for the aptitude and logical section, speed is a hurdle which can only be overcome by practice.

2. Build your communication skills

Even if you’re going for the role of a software developer, you can’t slack on roles of being personable and responsible. You should be able to express what you think to the recruiter. Show your enthusiasm and passion about the company. Practice with your peers for common interview questions to get an edge at group discussion. All in all, get comfortable with public speaking, this will help you deal with slippery situations. Try building your vocabulary and yes, please do read the newspaper.

 The tech interview

You will be required to solve a couple of questions. Try practising on a whiteboard, you can be so used to the compiler that you might just forget the syntax of initializing a variable when writing a code outside. Study your data structures and algorithms, read books, solve questions and use other resources.

Know your project

Your project is something that you must have put your heart and soul into. So, naturally, the recruiter expects you to know the nitty-gritty of it. Explain your project nicely, the hurdles you got caught into and how you overcame them while making it.

Think of the bigger picture

When solving a coding problem, even if you make a minor mistake, don’t panic, keep your calm and stay focused on the problem. Take a deep breath, you still have the rest of the interview to go through. The recruiter will most probably ignore the minor error, he’s there to check your problem-solving skills.

Be Honest

The recruiters must have a long experience of interviewing a lot of candidates so they are surely masters in this. Try to make your resume glitch free. Be honest with your answers, if you don’t know the answers, just say it, it’s not a college viva that you’ll get away with saying any bullshit. The interviewers already know the answer before they ask the question.

Ask Questions

Be vocal with your doubts. If you have any doubts, regarding the questions such as edge cases, etc, ask them and how they need to be treated. Avoid making any assumptions. Even if you think it’s pretty safe to assume something, try asking the interviewer first.

Give mocks and learn something new

Trap someone you know into taking your mocks. JK, take their mocks too. Get feedback regularly, and try overcoming minor glitches during the mocks.

Interviews are also a learning experience, and with every interview, you would definitely learn something. Instead of getting anxious over it, try treating it as a goal to learn something, have fun, treat your interviewer as a colleague you’d like to build an amazing app with, this would exude your passion about coding that got you in it at the first place!

Also, I may sound like your mother, but please get a good night’s rest before the D-day. It would double your efficiency!

To prep up with our help, sign up for our Interview Preparation courses here and avail your free trial for our online course NOW!!


Do you have the panache in you that sets yourself different from your peers?

Are you good at organising events in college(mass bunk also counts)?

Are you well connected and spend most of your times juggling societies and clubs in college?

Does your social game make your friends insecure?

Do you wish to get those extra points on your resume and that too in a fun-filled way?

If you answered most of these questions with a straight YES then what we have for you is exactly what you need. 😀 Coding Ninjas has launched their Campus Ambassador program for students ready to hone their Marketing and Leadership skills. Let’s add more Ninjas to your community!No automatic alt text available.

Eligibilty Criteria?

You need to be in a college, duh!

What we need?

  • All we need is for you to organise hackathons and talks(pre-placement) which are to be conducted on your campus.
  • Promote us on the college campus through posters(Offline), and Social media marketing(Online).
  • Maintain a database of your peers of all batches
  • Promote and associate us in cultural and departmental fests
  • Encourage your peers to use our very own CodeZen as a programming platform in your college

What you get?

  • Free merch!!
  • Extra points on your resume because we’ll provide you with a certificate on completion of your term
  • Linkedin recommendation to all eligible candidates!
  • special bonus to the Campus Ambassador of the month
  • An exposure of working with a start-up
  • A wonderful opportunity to become a part of Ninjas(Internship/TAship)
  • Interaction with experts professionals and get guided personally
  • Meet targets, and get our online courses absolutely FREE

Not only this, but also

If you write blogs for us, we’ll feature you on our website.

An out of the box idea will get a big SURPRISE from us.

Apart from this, you’ll get an amazing opportunity to expose yourself in the startup world, interact with expert professionals and communicate with other College Ambassadors to experience the life and culture of other campuses.

Come make the best of this opportunity and the join the wonderful Campus Ambassador Community to polish your marketing and Leadership skills!

Register here!

Why Coding should be taken as a skill rather than a subject?


A night before the data structures exam, I’m biting my nails and cursing why did I have to choose engineering, planning a strategy on what topics to leave and what to study, just enough so that I pass this semester without a back. I’m sure I’m not the only one who does this. All-nighters are the only way we know how to study in college, cramming the subject just the night before the exam.

Most people literally cram entire codes to topics a night before the exam. Guys, you are legends! But the fact is in the long run, this won’t help you. The more you cram, the less you’ll remember what it was about. Also, in the next semester, when a bigger version of the subject appears, you’ll start again with the same old cycle of cursing the subject, your decision of taking the course, the education system and so on.

Programming, instead of rote learning it as a theoretical subject, should instead be approached more practically. It should be understood and the codes should be practised instead of cramming. The concept of syntax, dealing with a problem through a particular method, and the “logic” should be understood. If you’ve done this bit, I bet you don’t even need to open the book before the exam(but please do).

Before I enrolled in the course at Ninjas, I didn’t even know that there was an actual code for Hashing ( I possibly must have left the entire chapter then :p) possibly because I thought it did not carry enough weightage for the exam. But I was so wrong.

Coding Ninjas not only teaches you a language, they teach you how to study. They start with absolute basics so that even newbies who don’t  know “hello world” can relate to the subject. The classes are loaded with brain teasers to kick start your brains, short teaching sessions and more questions to practice so that you focus on problem-solving instead of cramming. They don’t focus on the language or syntax but most importantly on how to approach the problem so that you can do the same for any other language. All of this, not only fascinates you but makes you fall in love with the world of programming.

Subjects which used to be complicated and scared you till death will now look like a piece of cake. Not only this, imagine actually creating something from scratch. Now imagine, a lot of people actually using “that” something which you made. Sounds like magic? Well, it is! This is what programming does for you. Your favourite app or the website that you love to browse are all things essentially based on programming.

To quote Ankush sir, the most empowering moment of his career was when he and his team launched the Facebook timeline and more than a 100 million people used it on the very day it was launched!

Get inspired. Start programming today to build something amazing for tomorrow!

PS: The weightage of hashing? Well, it’s supposedly one of the most frequent questions asked by Amazon. Don’t make the same mistake. :3

How to master a language inside out?

If you’re a newbie coder and slightly struggling with programming, don’t fret too much! Coding can be slightly taxing at first, especially when you are new to it. But once you make sure that you give it enough time and work, you’ll love it!

So, let’s face it, you want to learn a language, and there are so many ways you can do that, but the question is how can you really master a language? “Master” is a heavy word, but today all those bigwigs are actually looking for expertise coders. Besides, programming can be really stressful if you don’t approach it with a right mindset and attitude.

So, here are 7 ways to master a language inside out:-


The idea of learning a skill overnight is exhilarating, yes! and being so used to those “all nighters” for college examinations can make us think that that’s the only way to study, but NO, trying to cram programming overnight can be a big mistake.

One needs to take it one session at a time, giving every session ample amount of time and using it more practically than mugging up the theory.


Of course! What’s better than enrolling yourself in a course where you have amazing mentors to guide you, newbies like yourself to get along with, and TA’s to assist you through every step. An environment of healthy competition and learning in a group will not only keep you highly motivated, but you’ll also learn at your own pace.

Register for our courses  here!

For all those who are too lazy to get out from their houses(it’s the heat, we don’t blame you!) or people who live too far from our center, we have this awesome option for you, ONLINE COURSES! with amazing features like adaptive learning, individual TA support, and lots more! (A little bit of promotion never killed anyone!)


Well, who doesn’t get a hard time from the semicolon and the brackets?! If you don’t have any prior coding experience, the number of syntax rules in any coding language can make your head go for a spin. The best approach to this is practice, one needs to practice a lot of questions and over a period of time, those silly syntax rules will come naturally to you.

One needs to take practice seriously, solving a lot of questions will definitely build your expertise in the field and your approach to solving questions will develop, turning you into a Code Genin.


A very interesting approach to learning anything is the Feynman approach, based on the great physicist Richard Feynman who believed that the best way to grasp something is by breaking it into simpler concepts and teaching it to someone.

Explaining things to someone else will help you analyse your weak areas and will definitely solidify the concepts in your mind. It will help diagnose the weaker niches and compel you to learn things better from a newer angle.


One sure wants that edge when they’re learning the language, don’t they?  To get that extra panache in your coding realms, one must start with competitive programming. Competitive programming is a mind sport taking place in particular forum involving participants to program according to provided specifications.

Competitive programming will allow you to code under tight specifications. This will strain you brain to think under constraints, increasing your skills exponentially! Also, coding in an environment of healthy competition will keep you glued to it.

Join the world of competitive programming at CodeZen, Stand out in the leaderboard and win amazing cash prizes!


Once you’re comfortable with the language, syntax and the concept, it’s time to put those skills in to use! For absolute newbies, think of  a simple game like Tic-Tac-Toe, Othello, to head start with your skills. Building even a small project will not only build your confidence but you’ll know exactly how to apply your newly acquired knowledge actively.

Be creative! Code something that interests you or what you’d actually want to use. Projects will help you retain a lot better and will interest you at a very personal level.


Relax! It’s not you, it’s programming.

Programming can be a little intimidating and it’s okay to struggle with it. The important thing is to keep yourself on track and keep trying. Ask help when you need it, try different resources and keep recalling previous concepts. Give it a little time, and it will surely come your way.

Embrace your bugs and errors. Learn how to debug and avoid them in future. Practicing can help you build confidence, and that will keep you away from stress.

Computer Education for children: Recycle Bin is better than Trash Can

Coding-Ninjas_BLOG1Being a Mathematics and Computers enthusiast, I advocate early computer education for children, but being parent to one curious mind and educator to several curious minds, I want them to see what they are doing, why they are doing what they’re doing and where they are heading. I don’t want to serve them building blocks on a platter, instead I want them to choose their blocks judicially and learn to create on their own. They are blessed to be born in a time where technology is a given. What we learnt in our 20s and our parents are still struggling to learn, they are able to decipher in minutes. They are agile, they comprehend problems in their own unique ways and gadgets are their new toys!

Fear lies within

There was a group of 8th grade boys who came to me around 2 years back to learn JAVA for a year-end exam they had to write in 5 days. When asked for their course, they handed me their notebooks with some 20 odd hand-written programs. The questions starting from WAP… and programs starting from public static void main () {…}. And then, right from opening bracket to closing bracket, everything between the lines was learnt by heart, verbatim. There wasn’t any logical differentiation between ‘=’ and ‘==’, or a “,” and ‘;’ or ‘for’ and ‘while’ or ‘do-while’ loops. For all the excuses, there was just one justification “Our Sir told us this way!” There was no excitement or learning in this method.

Those 5 days were like right from scratch to the level they could write programs logically, without mugging up and they did well in the exam. But what happened next was disturbing. I asked them to write their codes on computer because eventually that’s where codes are meant to be written, not on papers. There was 10 minutes silence in the room and 20 minutes persuasion to go back to paper-pen, their hands trembled and finally they convinced me to copy their hand-written codes for that day! I agreed. But when it turned into compile-time and run-time errors and syntax errors to top the list, things got very interesting. Rectifying our own mistakes and learning from them, is a gift we give ourselves. The earlier we learn from it, the better we get and that much farther we can go.


Discipline is an Art

How beautiful it is to move into kids’ time-space and teach them the way they learn! Let them comprehend that while preparing their 2-minutes Maggie noodles, or their daily chores schedule, they can lead to something big like ALGORITHMS. How messy their noodles could be, or how chaotic their day could be if they skipped or re-ordered any of the steps. SEQUENCE IS IMPORTANT. How being in discipline can produce better algorithms and being smart and punctual can produce OPTIMIZED ALGORITHMS in time & space.

We are part of a vicious cycle

We need to make them observe the fact that our real lives are programmed too, either by ourselves or by nature. Once we start receiving those signals, we start finding PATTERNS in them. Why do their nursery rhymes end with similar rhyming words? Why do their dancing moves repeat the steps, why do they have to follow the same routine everyday and suddenly what happens on Sunday? Why do patterns break? How does the multiplication times table follow certain patterns, how does day and night follow a pattern or for that matter, water-cycle or butterfly-life cycle? When they learn these patterns, they tend to be inquisitive about patterns in general-how do they start and repeat, what is the sequence in each iteration, how many times does it repeat, when does it stop, will it ever stop or not? The answer to each of these questions is astonishing LOOPS. Vicious cycles and efforts to break these loops are the most fascinating part of programming.


Name is Enough!!

One sunny afternoon, my boy brought a music sheet from school and it read like this :

Verse 1

Yeah, you can be the greatest. You can be the best

You can be the King Kong banging on your chest

You can beat the world. You can beat the war

You can talk to God, go banging on his door.

You can throw your hands up. You can beat the clock (yeah)

You can move a mountain. You can break rocks

You can be a master. Don’t wait for luck

Dedicate yourself and your gonna find yourself


Standing in the hall of fame (yeah) And the world’s gonna know your name (yeah)

‘Cause you burn with the brightest flame (yeah) And the world’s gonna know your name (yeah)

And you’ll be on the walls of the hall of fame !!!

 Verse 2

You can go the distance You can run the mile

You can walk straight through hell with a smile

You can be the hero You can get the gold

Breaking all the records they thought never could be broke

Yeah, do it for your people Do it for your pride

How are you ever gonna know if you never even try?

Do it for your country Do it for your name, ‘Cause there’s gonna be a day…


Verse 1


Verse 2


Does it ring any bells? Sequence – yes, Patterns – OK, yes! But why Chorus written 4 times above, is just mentioned as CHORUS once and rest it’s just reference other times. Same holds for Verse 1 and 2. How drawing shapes, numbers, alphabets learnt once and you ask them anywhere, anytime, they have same quick response fetched from layers of memories and here is the answer! How this quick response is translated from already fed reference- in other words, FUNCTION CALL! Define once and use the name to refer to it as many times as you want.


Negotiation: War to Win or Lose or Draw or Mutual Agreement!

Who else can be the best negotiators than kids? Every now and then parents are negotiating on terms and conditions.

If you wake up on time then we will ………………….. else we will …………………..

If you finish your meal on time AND behave well then we will ……………else we will ………………

If you finish homework on time OR if you finish your project on time then we will ……. else we will ……….

And that’s how the story goes. Within these daily negotiation deals, we are making choices, CONDITIONAL choices, which is another building block of programming.

It’s all in-programmed thereafter

Once as a parent and educator you have exposed them to these faculties, their brain starts thinking this way. Introduce them to any programming language be it, C, C++, Java or any other high-level programming language or scripting language, they will master it. Give them real life scenarios, break them into smaller chunks, try to find granular steps and then look for patterns in it for repeating steps, loop them. Try to recall previous already done tasks instead of doing all-over again, prototype them. Life gives us new ways to look at.

Integrating other subjects to computers

Visual learning always has long-term effect. When children can see their times tables are following patterns and can be fed as data-entry in Excel Sheets and apply formulae on them, they see magic. When they can paint their imaginations in Paint or Canva, when they can write their stories or make projects in Word and edit them with crazy editing tools, we open a world of opportunities for them. Most fun is when they want to show off their skills to the world and PowerPoint, Prezi, blogs, websites become their best resorts, let them flaunt. When they pick up TED-Ed talks, YouTube documentaries, or Pinterest for research, let them quench their thirst for knowledge, you’re upbringing an independent learner. Schools are no more monopoly of knowledge, the world of internet when guided judicially, can hone ignited minds.

Computer Education is more than Programming-Coding and Digital Literacy…

While being a computer pro, where my half my day is spent in front of the laptop, I have assigned limited screen-time to my son who is 7 year old. When I see new parents pleasing their children with smart phones, I-pads and tablets, as a substitute for their time, as an excuse of making them tech-pro and boasting about their gadget handling skills without educating them for digital footprints or cyber security, my heart goes off. Science and technology can make or break a child’s future, depending on how you use them.

When I asked my son, why he liked to work on computers, his first reply was that he could edit his mistakes instantly. He could learn, re-learn and unlearn to achieve perfection. And second was that he wanted to save papers. Recycle bin is better than trash can. His future plans are to become animator for Pixar movies because he loves math, drawing and he believes that he can code them for his creations soon!


GSOC – Time to pick an Org!

BLOG_GSOOCWith Google Summer of Code 2017 Mentor Organisations just announced, students are (and should be) in a frenzy to pick and get familiar with an org of their interest and start contributing as soon as possible. To help along the matter, this post aims at enlisting some of the most popular organisations based on the technology used in their projects. A quick look through should be good to let the students know the most popular choices!

CODING-NINJAS-ANDROIDZulip : Zulip is a powerful group chat application. The server is written in Python with Django; you could also work on cross-platform mobile and desktop apps, or our many integrations

Systers, an Anita Borg Institute community : Increasing the number of women in computing fields and technology.

FOSSASIA : FOSSASIA is the premier Free and Open Source technology organization in Asia for developers, designers, start-ups, and contributors.

Mifos Initiative : FinTech non-profit leveraging the cloud, mobile, and open source community to deliver digital financial services to the world’s 2 billion poor and unbanked. : We are, a small team of space makers solving space problems together with KSat-Stuttgart e.V. and the Cosmic Dust Team.

aimacode : This project provides implementations of the pseudocode algorithms in the textbook “Artificial Intelligence: A Modern Approach,” along with tutorial examples of algorithm usage. Foundation : Through Linux and other open source tools, seeks to make enabling computers to interact with the physical world as simple as coding a web page.

Copyleft Games : We produce libraries, engines, frameworks, and development tools for producing games, especially as part of educational environments.

Python Software Foundation : Python is a popular high-level programming language used by scientists, developers, and many others who want to work more quickly and integrate systems more effectively.

python-django-coding-ninjasDjango Software Foundation : Django is a high-level Python Web framework originally designed to build high-performing, elegant Web applications quickly.

Cadasta : Cadasta is working to build a future where, through technology and community partnership, land and resource rights are universally recognized and protected

CloudCV : CloudCV is a young open source platform to make AI research reproducible by making it easy for researchers to build, compare and share state-of-the-art AI algorithms with everyone.


KDE : The KDE community produces Free and Open Source Software and brings together artists, designers, programmers, translators, users, writers and other contributors from everywhere.

Mozilla : We’re Mozilla, the proudly non-profit champions of the Internet, helping to keep it healthy, open and accessible to all.

RoboComp : RoboComp is a cutting-edge open-source robotics framework providing tools to easily create, modify and manage robot software components.

SymPy : SymPy is a Python library for symbolic mathematics.

The Linux Foundation : The Linux Foundation is a non-profit consortium dedicated to fostering the growth of Linux. Hosting the Linux Kernel. OpenPrinting, Linux Standards Base, SPDX, …


Ruby on Rails : Learning to build a modern web application is daunting. Ruby on Rails makes it much easier and more fun. It includes everything you need to build fantastic applications.

Ruby Science Foundation : SciRuby is oriented towards providing science and visualization infrastructure for the Ruby Programming Language. We develop and maintain several libraries for this purpose.


There are many more organisations with a much larger number of projects present that should be explored but the above list is good if you are a beginner and unsure of where to start. For more information on getting your feet wet in the wide pool of Open Source and GSoC, refer to

This list was curated from my previous experience as a mentor in GSoC 2016 with Systers, An Anita Borg Institute, an experience I hope to repeat this year.

Feel free to leave any comments, questions and doubts in the comments section below!

Recursion (The Good, the Bad and the not so Ugly)

Recursion is a topic most beginner programmers fear and when you get the hang of it, it works like magic (Congrats! Not a noob anymore). When someone introduces recursion, they say it’s basically a function which calls back itself, and your brain goes like WHAAAAAT??

So here’s this GIF which not only gives you a complete mindfuck but also a visual description of what recursion is. Too scary huh? Well, not really. Once, you get an idea of how recursion works and  which base case to work with, it runs smooth as ice. Sometimes, you won’t even be able to fathom how your code worked when it did.
Well, the mantra for recursion is ” Let recursion do the work for you”.


1. For all those people who want to make their code look pretty as a picture, recursion is the best way to do that. Recursion makes a code more compact, readable and so very elegant.
2. If you can master recursion, it can turn out to be your best friend. Solutions using recursion are easier to strike and code. It also avoids redundancy of code, and your codes are easier to read and maintain.

3. Three magic words: tail call optimization: Some functional languages implement this wizardry. So basically, what happens is, if a function’s return expression is a result of a function call, the stack frame is reused instead of pushing a new stack frame in the call stack. Sadly, only a few imperative languages have this wizardry.


The secret magic of tail call


A lot of programmers avoid using recursion and believe that it is less efficient than it’s iterative counterparts.

 1. Recursion can lead to the perils of stack overflow. To understand better, let’s look at the steps for functions call:-
  •  space is carved out on the stack for function arguments and variables.
  •  arguments are copied into this new space
  • control jumps to the function
  • function code runs
  • function results are copied into the new value
  • stack rewounds to its previous position
  • control jumps back to the caller
Mostly, all of these steps consume more time than their iterative counterparts. Therefore, recursive methods are relatively less efficient in those cases.
2. More importantly, when most programs start, they allocate a single chunk of memory to the stack, if that memory is used, the entire program crashes due to stack overflow.
3. Each function call eats up a lot of space. That amount of space isn’t recovered until the function returns. Iterative methods do not suffer from such problems.