Saturday, June 22, 2019

Rain

I love Brunch, the Sunday magazine which comes with Hindustan Times. I have been reading Vir Sanghvi's editorials and food columns since, I don’t exactly remember, maybe class ninth. So was going through it and saw an article on monsoon. It was well written and reminded me of the several monsoons I have been through.

There was a time when, in Patna, it didn't just rain. We were used to seeing thundercloud and lightning!! The day used to turn into night, you could have seen stars, if not for clouds! And it was such a treat! Getting soaked to the bone, you know it takes time to get that soaked in a drizzle, and then Ma asking me to change clothes, what I would not give to get those days back!

There wasn't a year when we didn't have to wade through naalas to get the cake for Reshu or Gudli's birthday! Quite a feat, I tell you!

I spent next three years of my life in Jharkhand. Beautiful places, both, Bokaro and Jamshedpur. I remember getting drenched while riding a bike on my way home from school! This happened on a regular basis, may have something to do with my choosing to leave school when it started raining!

One distinct memory is of standing in the balcony of 7264 while it rained! It didn't just rain, the rain was usually accompanied by a strong wind! The huge field in front of balcony had a few trees and a lake, and man, it was such a beautiful sight!

It still rains, but it doesn't in the way it used to. I have been waiting to go back home and experience those thunderstorms, those days-turning-into-nights kind of thunderstorms which I haven’t experienced since I left home. Maybe I will, someday. Most probably I won’t.

I miss rain.
Share:

The. Nahi bhi the.

[Copied from my Facebook notes, wrote it long back.]

पता था,
नही भी था|

तुम थे,
नही भी थे|

तुम्हारा इल्म था,
एहसास नही था|

तुम मिल रहे थे,
तुम बीछर रहे थे|

हमारा क्या था,
कोई था, नही भी था|


--------------------

Pata tha,

Nahi bhi tha.

Tum the,

Nahi bhi the.

Tumhara ilm tha,

Ehsas nahi tha.

Tum mil rahe the, 

Tum bichhar rahe the.

Humara kya tha,

Koi tha, nahi bhi tha.
Share:

Wednesday, June 19, 2019

Make Anagrams, or, Remove duplicates

Intro:
This is a very basic question. I am writing about this just because I want to get into a habit of writing technical stuff. I am not so good at expressing my ideas and that is why I am starting out with such a simple example. I hope to start writing and keep on improving my writing skills. Any suggestion is welcome. 

Problem Statement:
There are two given strings. You have to find out the minimum number of character removals from each string so that both become anagrams.

Link to problem.

Thought Process:
The idea is to keep a count of all the characters in both the strings in two different arrays and then compare the counts. If there is a difference in count, the character has to be removed. Therefore, the difference needs to be added to the total count of characters to be removed.

Example:
String 1: abd
String 2: ace

Remove b & d from first string and c & e from second string and you have an anagram.
Total number of removals: 4

Code:

def makeAnagram(a, b):
    arr1 = [0] * 26
    arr2 = [0] * 26

    for c in a:
        arr1[ord(c) - ord('a')] += 1
    for c in b:
        arr2[ord(c) - ord('a')] += 1
    count = 0
    for i in range(26):
        diff = arr1[i] - arr2[i]
        if diff < 0:
            diff *= -1
        count += diff
    return count

Share:

Friday, June 7, 2019

First Post!

I have been thinking about posting for a long time.
Too long, I think.

I went through several blogging platforms, read reviews, thought a lot and talked a lot. At last, I realized the best blogging platform is the one I start writing on!

Now, coming to the purpose of this blog, my life, the universe (mainly, this blog)-
1. Write about technical stuff I learn, 
2. Write stories and experiences, stories from my experiences, and,
3. Anything which catches my fancy.

Hope this time I continue writing.
Share: