Saturday, February 27, 2016

Interview Preparation Questions

1. Find the shortest substring that has atleast M distinct characters. Example: M = 3; Original string: AABBAAC Answer: BAAC

2. Length of the longest substring without repeating characters.

3.  Given a binary tree, check if it is a binary search tree or not.

4. Given n coins for two players playing a game. Each player can pick at least 1 and at most 5 coins in one turn. The player who picks the last coin loses the game. If they play optimally, which player will win the game?


5.  Given a continues stream of number, find the one with maximum occurrence. the same can be used for words as well


6. Least common ancestor in a binary tree - not BST binary tree


7. The handshake problems: one where outside person asks the question and one where the host does.

8. Given a running stream of numbers, find the median for them.

9. Given a string of 0 to n numbers find the missing number.

10. Given 1000 bottles with poison in them, find the minimum number of cats required to find the poison bottle.

11. Given 10 coins with equal number of head and tails, divide them into two groups such that both have the same number of heads and tails 

12. Given  two words find : union , intersection and difference in them

13. Given a list of words, find the prefix for each wrds to uniquely identify them.

14. Reverse a linked list.

15. Find set of continuous elements in array which sum to target.

16. Convert binary tree to double linked list.

17. Find height of tree.

18. Print paths to all leaves in a tree.

19. Get shorted path from one node to another in a graph.

20. Find k nearest element to origin.

21. Find all possible permutations of a string 

22. Convert a number into its word representation.

23. Convert roman numerals string to integer.

24. Validate whether tree is binary or not.

25. Check if string is palindrome

26. Find duplicates in list.

27. Check if string is anagram.

28. Travel n ary tree breadth wise.

29. Find if number is prime or not.

30. N-Queen Problem

31. Stable marriage problem.

32. Given a set of distinct integers, S, return all possible subsets.
      If S = [1,2,3], a solution is:
      [
  [],
  [1],
  [1, 2],
  [1, 2, 3],
  [1, 3],
  [2],
  [2, 3],
  [3],
]
33.  Print Left View of a binary tree.

Saturday, September 19, 2015

She is ...

"I don't like this, and why daily the same chapatti, 'daal' and 'sabzi'"?, angrily I kept the plate aside, frowning and displeased. 

"Beta, this is healthy and will give you the necessary portion of energy and proteins. Yesterday, you had dinner at a party, morning you survived on bread which is 'maida', it is not good for your stomach. If you want, I will cook something else for you, but please don't skip your meal", she said feeling sad and upset at the same time.


She knows very well that children don't understand the value of mom until they grow up to become a parent themselves.Perhaps, she too did the same when she was young, and so she knows. She feels sad for being thrashed every time rudely by her children, her in-laws and something by dad too when he is too engrossed with his work and she forces him to eat.


She gulps everybody's frustration without saying a word. She wakes up in the morning before everybody does, gets ready, prays to God for her family, cooks for everybody, packs lunch, packs bags for schools and office, puts clothes for laundry, serves breakfast, gets them ready for school and office! After 2-3 hours of daily chores, she sits down to complete the tasks that were pending for her forever. 


Let's start the checklist for her: Cooking for the audience with variety in demand, cooking with abundance (time/help/grocery). Present it well, those 3 tiffin boxes, that relative's visit. Doing all the above and leaving the place clean once done. 

Wait Wait! Father in law is diabetic, Mother is law has high BP .. less salt in her food.
Husband loves salt and can't do without it. Kids! They will always have special demands.


Reuse of food, reduce waste so recycle the same food with a different form of presentation. Keep in check balanced protein, veggie and taste too?? yesterday also had aloo, today too? Who will keep a check on that? And guests coming today :-D Need some creative dishes with varieties.! 

Yet she is able to serve hot food with so much love smile and empathy. 

Dear Moms, you will always be our rockstars :) 

You never know who you are inspiring

Hi! said, the girl excitedly expecting him to be as friendly as she was. He replied with a low hi, lowering his head and getting back to his thoughts on the high complex problem's solution, may be some MVC architecture , or some server level problem, who knows what these brilliant people keep thinking in their life or about life. She just admired him, inspired and wanted to be in contact with this amazing person. She became sad, walked back to her cubicle thinking that he doesn't like her because she was normal plain girl with no intelligence at all.On the other side, he never cared. He was an introvert, not befriending with people easily and made selected friends.

Here, the luck turned to her side and like always, what she wanted came to be true. She got several chances to talk to him. What else on Earth could have she asked for. Highly inspired by the guy she used to try to learn how he works, what is his thought process, how he approaches a problems. She was in total love with him because of his knowledge, brain and multi-talented  personality. He is also an amazing singer. Mere words could not describe him. He was that special and superb. 

He was born and brought up in Delhi. He did his BSc in Chemistry from Delhi university and then MSc, again in Chemistry from Hansraj college in Delhi. He pursued his Phd but quit in mid term.. He managed to get a job in Chennai, which was lasted a month and a half as the firm went out of business. He taught for a year as a teacher to manage his hostel and mess fees. Later when his father came to know about the hardships his dear son was facing, he called  him back to Delhi and helped him in finding a job in some software company. Having worked there for sometime he then went on to create his own software which was related to the concept of soft phones like skype etc. Later, he Sold his company after two years and was introduced to the world of hacking. After gaining immense knowledge about hacking and the dark and shady world of it, he left all of it and joined a reputed software company and is currently excelling at his job.

She felt lucky to have met such great and awesome person. The walk with him was a privilege for her where she learnt things about him.He is the most amazing person she will ever know!





Monday, January 26, 2015

We are 'NIT'ians

1. The first and the last days of college will always be full of tears. The former for leaving the comfort of home, starting a new phase of your life by joining college while the latter for leaving the fun and your friends behind.

2. Pointers do NOT matter. (Trust me on this, there will be a couple of times when you feel that they do matter :P)

3. You will find no professor worthy enough to listen to, even for five minutes of your life.

4. You will have to keep explaining to your relatives and friends from non-engineering background that it’s an 'NIT', with a single ‘I’, and not an 'NIIT' that is found in every third street of the town.

5. Again, you will need to explain to your distant relatives why the far-away-college you go to is better than the college that is just a few blocks away from you in your hometown.

6. During the first year of college, you would eagerly look forward to being in the final year, which, when the time finally comes, like an achievement unlocked, would seemingly make you everybody’s boss. And once you’ve climbed upon the stairs of the final year, you would long for the duration of the course to not be limited to just four small years.

7. Your opinion about ragging in the first year and that in the second year will be completely different.


8. You will always complete (read copy-paste :-P)  the assignment just a few hours before submission.

9. You will meet people from different parts of India, and for that matter, some foreigners too, and you will be flooded with friendship.

10. You will always have a lingering feeling that college will not be of much help in brightening up your future, or illuminating your life academically. To make matters worse, you would, in fact, keep wondering why you ever went to school in the first place if it had to end up with your having to study in this college.

11. Nescafe stalls and the chai- wala spots will be junctions to meet, gossip, exchange notes and escape lectures.

12. You will find your seniors and juniors to be more attractive than your own batch-mates Deep down, your heart will wish that they were in your batch.

13. In your own batch too, there would be that one person whose face you would want to see and eyes you would long to have contact with as soon as you entered the classroom. You would wish that they sneakily looked at you whenever the teacher asked you to rise and explain something, that they were your partner in crime whenever your skull cooked up a cranky idea. They would be the force behind your waking up for the early morning class. With them, you would have an array of moments, not limited to the constraints of space and time, the modulus of which would never be enough to suffice your hunger for more. They would add the much needed flavour, seasoning and spice to your otherwise boring academic life. They, my friend, would be your crush. They would drive you crazy, and have you, in turn, drive others crazy.

Friday, November 7, 2014

From what we get, we can make a living; What we give, however makes a life!

A Day of Care, A Day of Joy! 

With all the thrill, joy,excitement and eagerness to know what this beautiful sunny adventurous Friday had saved for them, the kids came running towards the buses no sooner when the bus arrived at the gates of SOS Children Village Hyderabad.

They hijacked the buses , not even being skeptical for a single minute, grabbed their seats showing immense happiness and  enthusiasm. They were already amazed with big AC Volvo buses with big seats and perhaps more comfortable than their non-profit govt school buses they are used to, they started chirping and shouting "akka what is you name?" , "Sister, i want to dance", "Akka songs please", "Akka Window open  ..  and so on..

Each beaming face was so eager to talk to you, tell you about their cousin brothers and sisters who were with them in the same trip and how thankful and happy they were to get a chance to go a Zoo and see their own favorite birds and animals. Some were little shy to talk but never forgot to pass back a smile with sparkling eyes to show their appreciation for paying attention to them. They were given chips water to munch for the journey.

We reached the zoo gate and they followed our instructions like an obedient child willing to do anything given a chance to enter the zoo and explore nature. Running with all the energy their small weak legs could provide, they started pointing at the known common animal names. There was this kid who did not forget to carry a paper and pen and carefully jotted down all the names of the wildlife creatures that she encountered.


The sultry and sunny afternoon where the sun was shinning with all its might did not succeed to drain all the energy of these young and little fellows. They were given their packed lunch and juice. All charged up again showed great interest to go and have a look at the amphibians.



And it was time to mark an end to this amazing zoo trip with the kids and get into the buses so that they can be dropped back to their abode where they can continue to live like any other day with the only hope to get better and better each day. They were given chips, juice and bananas as evening snacks. It was a treat to them when the bus stopped in middle so that the delighted children can get more cooler with their favorite ice-creams. The small hands bid goodbye and asked with curiosity and hope as when will they see us again and we promised sooner than they expect :)



The day was filled with joy, appreciation and left a lasting impression on our memory. We had already started feeling attached to these beautiful souls who always smiled while talking to you. Loved their energy and enthusiasm they had with them every minute. It felt as if you made the day special for someone out there... I am already feeling blessed and humbled to get an opportunity to spend some time with them and make a little difference in their just one another day of life.



Monday, August 25, 2014

Automobile Tracker

Here is my first windows app on store.

Here is the link

What is this app about? 

You can track the public transport of Andhra Pradesh and you use for your own safety. A WP mobile app. Knowledge is power, if we know it, we might avoid it! Check the registration details of a public transport - auto or cab to ensure its an active vehicle, not stolen. Planning for a weekend outdoor trip? It would help if you can check the hired vehicle has some challans for that extra driving security for you and your family. Late at night getting into an auto or cab, take a picture of the registration plate, let the OCR parse the text and SMS it to a near one. Also the pic is saved for future reference. In case you forget something in a public transport, you can trace back your steps, each vehicle no. you searched for is stored in your history. Want to use it, no need to wait, app is now published on Windows Store App. Your Safety, Your Priority!



Saturday, June 14, 2014

Adolescence

Adolescence was not kind to Jessica.  Whenever she looked in the mirror, a pudgy pre-teen looked back at her.  She avoided mirrors, cameras, anything that could reflect or record her image, dreading the thought of having to see her true self.    
   
She had a friend who was everything she wanted to be, Jennifer Lawrence.  She was tall, thin, beautiful, well-dressed and well-liked.  While Jessica was more the introvert, taking her time to warm up before getting social, Jennifer was always the center of attention making friends the instant she walked into a room.  She lived vicariously, watching boys fall over themselves trying to get her attention.  Even teachers seemed to treat her better than other students.

How much better my life would be if I could only be more like Jennifer Lawrence!  So Jessica tried.  She played the sports Jennifer played, wore similar clothes, tried diet after diet to match her slenderness, talked like her, walked like her, and acted like her. She was convinced she had the formula for success and happiness.

Then one summer her mother found her trying to bleach her hair.  Some chunks of hair had turned pumpkin orange, some nearly white and the rest reddish-brown.  Her mother was devastated, as was she.  When her mother asked her why would she do anything to ruin her beautiful brown hair, she told her how much she wanted a better color, like Jennifer's.  In her great wisdom, her mother said

"It's funny how we sometimes want what we don't have.  The grass seems greener on the other side of the fence.  But then, when you get there and look back, you realize the grass was just as green if not more brilliant on your own side.  If you spend all of your time trying to be someone else, there is no time left to discover who you are.  What you need to remember is no one can be a better Jennifer Lawrence than Jennifer Lawrence, in the same way that no one can be a better you, than you yourself.  So, it makes no sense to waste your time trying to be her.  She will always do a better job than you can.  But if you focus on being the best you can be, no one can ever exceed you."

It was a great lesson for her.  Being true to herself was effortless in comparison to trying to be someone she was not.  The more she honored what was authentic to herself, the better she performed, the more confident she became, the bigger the impact she made and the happier she was.  It was a lesson she carried into her professional career, because there will always be pressure, whether external or self-imposed, to conform to a perceived model for happiness or effectiveness or potential or whatever you happen to be measured against.

Individuality is one of our greatest assets.  It requires a commitment to know thyself, plus vigilance in resisting the temptation to become something we are not.  It takes courage to speak your truth and follow your passion, particularly when it departs from the status quo, but the closer to genuine the greater the likelihood for success.  Interestingly, what is true for the individual is also true for business.  Companies that get caught up in the competition and stray too far from their core competencies frequently flounder or fail.  Those resurrected are often saved by reconnection with the fundamentals of their unique raison d'etre. 

If there is a moral to her story, it is this: there will always be a place for the unique person you are, so be at ease with what that means to you and confident in knowing it is more than enough to succeed. 

Lauki pizza at home

  Try this low carb healthy lauki pizza at home. Lauki Pizza Recipe - 1. Lauki 1 2. Oats flour 1/2 cup 3. Parmesan cheese grated 1/4 cup 4. ...