Investigating Memory Leaks in Java

Recently, at work, I was handed over a web service that was largely forgotten. It was written in Java and it’s only responsibility was to power a reporting console used by the operations team in the eCommerce company that I work with. The job was simple, one of the backend services that this service uses […]

Cracking the Oyster

Cracking the Oyster  Problem Statement  Input: A file containing at most n positive integers, each less than n, where n = 10^7. It is a fatal error if an integer occurs twice in the input. No other data is associated with the integer.  Output: A sorted list of increasing order of input strings.  Constraints: Limited […]

Compute Random Permutation

Compute Random Permutation Problem Statement  Design an Algorithm that creates a uniform permutation from (0 – n-1).  Given a random number generator that return a number (0 – n-1 ) with equal probability. Use as few call to it as possible.  Problem Solving Immediately I thought about the shuffle algorithm. However here we are provided […]

Don’t just Learn, PLAY it…!!

Don’t just learn, PLAY it..!! After having set up the problem solving blog and observing it’s value in mere few weeks. I have now understood the benefits of regular practice, of doing and moving slowly rather than rushing and falling down miserably being. When I use to do that I use to fell hurt myself […]

Sudoku Checker

Sudoku Checker Problem Statement Given  a vector<vector<int>> of size 9*9. Check whether it is a valid Sudoku or not.   Problem Solving  I thought of starting with Iterators, writing Iterators for row iterator a column iterator and square iterator.  This got me involved in a lot of Object Oriented Problem and how to implement == nicely.  […]

Offline Sampling

Offline sampling  Problem Statement  Write a program that taken a vector on n integers and return a random sample of size k. All sample must be equally likely.  Problem Solving At first, I had trouble understanding what exactly is a sample,how do measure a probability of such a permutation.  After a while I thought that […]

Next Permutation

Next Permutation Problem Statement Given a permutation M, return the next permutation. Problem Solving   In this problem, the first thing that clicks is to observe examples.  And after multiple attempts, I started seeing a pattern.  First of all we need to see if there is a next permutation. If the sequence is already in the […]

Catch Me On Social !!