Here’s the problem statement: Given an array of integers that represents supermarket-purchase-points accumulated by customers. The points are arranged in the order of period of customer membership and no 2 members have the same points. Find the minimum number of free items that must be given out to the customers such that every customer receivesContinue reading “Scribble 4: Free Items”
Author Archives: thecodescribbler
Scribble 3: Longest Mountain Range in the array
Here’s the problem statement:Given an array of integers, find the length of the longest mountain in the array.Mountain here represents a subarray where the values of the constituent integers first follow a strictly increasing and then a strictly decreasing order. For example:The array: 10, 12, 40, 30, 20, -1, 5, 6, 1Output: 6 where theContinue reading “Scribble 3: Longest Mountain Range in the array”
Scribble 2: Quadruplet Sum
Here’s the problem statement:Given an array of unique integers, find all quadruplets of distinct integers (in any order) that add up to a given target sum. For example:The array: 10, 20, 30, 40, 1, 2Target sum: 91Output: [[20, 30, 40, 1]] Let’s dive into the solution: Let’s try to build the solution using the insightsContinue reading “Scribble 2: Quadruplet Sum”
Scribble 1: Triplet Sum
Here’s the problem statement:Given an array of unique integers, find all triplets of distinct integers (in any order) that add up to a given target sum. For example:The array: 4, 19, 8, 6, -1, 15, 10Target sum: 13Output: [[4, -1, 10,], [-1, 6, 8]] Let’s dive into the solution: We can extend the approaches usedContinue reading “Scribble 1: Triplet Sum”
Scribble 0: Pair Sum
This is the first problem listed on most coding platforms. Here’s the problem statement:Given an array of unique integers, find a pair of distinct integers (in any order) that add up to a given target sum. For example:The array: 4, 19, 8, 6, -1, 15, 10Target sum: 9Output: -1, 10 Let’s dive into the solution:Continue reading “Scribble 0: Pair Sum”
Indescribable
She is a bit of everything, She is indescribable, Her story needs a longer excerpt, Maybe a novella, Or perhaps, A cannon of collected works. She is a piece of fire, She is a piece of ice, Sometimes, sweet as a slice of cake, At others, sour as one of those grapes. DoContinue reading “Indescribable”
That smile that she betrayed :)
And there she sat, For 15 hours straight, In her spectacles and that lovely braid. Her ever-delightful face, now looked grave, ‘Another bug!’: she exclaimed. And there she sat, For many hours straight, Studying a 100 Chrome tabs that she had opened, all in haste. And there she sat and stared at that blackContinue reading “That smile that she betrayed :)”
With love
[ Following is a purely fictional dialogue exchange and bears no relation to reality ] “You never agree with me.” “Well, that my darling Emma, is precisely the cause of your academic success. Besides, the only time I recall we agreed upon something was when I asked you to marry me. Which is why we’reContinue reading “With love”
Newborn Mother
6th April, 2019 Hello dear Diary, I’m sorry we haven’t met in twenty-four, maybe twenty-six months. Who can count? Really, becoming a mother has swirled my life. Not that I don’t like it but may I confess, and only to you that it really is so very exhausting. I always run low on energy now.Continue reading “Newborn Mother”
Blue
Blue is a feeling. It is God’s signature attesting peace. It is the expression of being content. It is the fresh feeling of waking up at dawn to a relaxed day ahead or of falling asleep on the same bed you have for weeks but today, in peace, with all your work complete. Or theContinue reading “Blue”