Visualisation with Pydot Part I

In this post, I'm going to talk about drawing trees and graphs programatically. I've written several answers on quora regarding recursion where I had to manually draw recursion tree as in Finding Subsets Solution I'll try to visulise this recursion tree programatically in the second part of this Visualisation...
Share:

GCD of all of the subarrays

In this post, I'm going to explain about a question which I came across on quora. The question asks us to calculate gcd of all of the subarrays. If you don;t know what subarray is visit here. Suppose A = [1, 2, 3, 4, 5] then subarrays are: [1], [2], [3], [4], [5], [1, 2], [2, 3], [3, 4], [4, 5], [1, 2, 3], [2, 3, 4], [3, 4, 5], [1, 2, 3, 4], [2, 3, 4, 5] [1, 2, 3, 4, 5]. Our objective is...
Share:

How to save offline documentation of language, framework or tools

Frequently, I have found myself going back and forth through the official documentation of language or frameworks. This kind of gets annoying sometime when the internet is slow and I have to frequently go back to google and type "X documentation" and opening the links and searching for function or...
Share:

Project Euler 37: Truncatable Prime

I read the problem statements from both of the problems on hackerrank and project euler. The problem at hackerrank is more general and has specific constraints. Here is the problem statement: The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits...
Share:

Yatra 3.0 Coding Competition

I recently participated in a coding competition organized by National College of Engineering(NCE) at Yatra 3.0. I'll be sharing my experience in this blog post. Here is the info about the contest: There were 7 programming questions, out of which we were required to solve any 5. No internet was allowed. The only languages allowed were C and C++. Total time available was 1:30 mins. The evaluation...
Share:

Leetcode 78: Subsets

In this post, I'm going to talk about a problem on leetcode which asks us to find all the possible subsets of given list of integers. This problem is the base to solving other problems like subset sum and subset partitioning which I'll be discussing in coming posts. Let's get started: I'll be solving...
Share:

What are *args and **kwargs in Python

In this post, I'm going to talk about *args and **kwargs in Python which is a useful concept while handling multiple arguments. They are called *args and **kwargs in Python which allows the function to accept optional arguments(positional and keyword). Let’s see with an example. At first, let’s make a simple function that accepts a single argument, first_name. >>> def person(first_name): ......
Share:

What are map, filter and reduce in Python

I wrote a post about map, filter and reduce on Python a while ago on quora. In this post, I'm going to talk about map filter and reduce in detail with examples. Let's get started: Basically map, filter and reduce gives functional programming features to Python. But before diving into these three functions let me talk briefly about lambda(Hopefully I'll be writing another post about lambdas) Lambda Let...
Share: