Thursday, May 14, 2020

LeetCode Problems Asked At FAANG Interviews - Part 1

The world has seen a number of job cuts worldwide. Some of the software engineering workforce has quit their jobs by their own will.

In such trying times when all economies are dwindling, it is the chance for the workforce to instead of giving up, pause and introspect on their ideal next workplace, and give their best to come out of the lockdown with flying colours.

I am a Software Engineer myself and with the aim of providing a not so unconventional path to help other software engineers reach their similar goals, in the last 2-3 weeks of my free time I audited the frequently asked problems at one of the big gigs in the software industry, particularly focussing on Amazon, the 'A' of "FAANG"(Facebook, Amazon, Apple, Netflix and Google).

In this blogpost I have collated some of those problems asked at Amazon, which will be useful for anyone preparing for interviews at Amazon and also someone who is trying to just get started with interviewing in general.


Amazon Interview Questions solved and audited by me:


I would encourage all those who are getting set for preparing them for interviews to go through these problems by their own and feel free to ask their questions and share their doubts with me to keep this discussion open-ended and the Let's Code_ problem solving community alive! As you would have seen, the problems asked at Amazon are fairly simple and most come under the easy category of problems on LeetCode so they are good for starters.

Mock-interviews go a long way to help judge your standing among peers and have helped me many times as well.
I particularly conduct and give interviews on PRAMP (www.pramp.com) an acronym for PRActice Makes Perfect, and if you ever need PRAMP credits to sharpen your skills, feel free to get in touch! Do ping me with your account and I'll be happy to share some with you.


Until then, Happy Coding!!


Lockdown and Upskilling Problem Solving

Being busy has never given anyone a chance to reflect and up-skill themselves.

One of the best things a programmer can do to up-skill their coding capabilities is to work on the Art of Problem Solving and becoming world-class in doing it.

Why not must one utilise the Lockdown period with up-skilling oneself using techniques outlined by veterans like the CCDSAP curriculum which is laid down as a guidance mechanism to gain control over exactly what you want - problem solving using programming!

With the same line of thought in mind, I have restarted my programming practice and I'll document for you, how I go about the curriculum as we progress through this blog!

There are a few other up-skilling sites I keep in touch with like spoj.com, leetcode.com and hackerrank.com and I'll blog about solving problems there as well.


So, Let's Code!!!

PC: dreamstime.com

Friday, January 3, 2020

A Oneliner for grepping character-by-character differences between two files anywhere on filesystem

Long story short:

Install git.
Hit this at command-prompt from within any git repo(can create afreash using `git init`):

 git diff  --no-index --word-diff=color --word-diff-regex=. /path/to/file1 /path/to/file2
Sample Result:



Dear Cybernauts,

Many a times you might have wondered a way to compare 2 files not just word to word but character-by-character, nicely coloured, and easy to spot on minute changes!

Without finding anything easily on the Internet apart from purchasable solutions (such as desktop versions of diffchecker.com..) not worth the pennies, I dug up some manuals and found it worth the effort to document it for the lazyweb. There you go! ^^ 😉(HaCk tHe BuSy-NeSSeS build on top of it!??!!! Use the 'man' if needed!)


~Namaste
🙏

Monday, October 21, 2019

Guard clauses - avoid over dependence on "else"

I had gotten used to using guard clauses quite early on in my software engineering journey!

saw this pattern in the code base of the GNOME project, Empathy, during my internship with them and was greatly impressed by this way of checking preconditions in every C function. From there on, I inculcated this strikingly clear way of stating assumptions and structuring functional code in my code style!

A few minutes ago, I received a notification of the following new medium blog post titled "Stop Using Else in Your Programs", in the "Better Programming" category and deemed it worth sharing:


Enjoy, and happy hacking!

Monday, September 16, 2019

Engineering wisdom from a Senior in Software Development and Engineering

I won't bore you by lecturing what has been often described before. This man, Neil Kakkar, did an amazing job at summarising (and kudos to keeping his mind open to learning these finer details) what he learnt from the craftsmanship of a Senior Software Engineer while working under his guidance:


I would definitely have things to add on to this list, but I'll keep it for a future post. For beginners, this is definitely a read worth your time, though I agree- some things only come with experience and most young engineers don't realise the importance of such development disciplines until they have themselves faced the consequences of not having followed them!

Sunday, April 7, 2019

Google Code Jam Qualification Round 2019 - My submissions and Post Contest Analysis

Hello World!

As promised in my last post, here are my submissions along with post contest analysis for GCJ Qualification Round 2019.

In all, I made 2 successful submissions (and one mis-formatted output submission that costed me some penalty) and with that I was able to score sufficient points for clearing the round and advancing to the next level! :) 👊
I also went through the third problem in the contest and came up with a solution but I couldn't push it in in time. I'll upsolve and share the remaining un-submitted problems here shortly.
So, without much ado, here are the problems that I did:

Problem 1: Forgone Solution
The solution I coded was written with all 3 and specially the largest hidden test set in mind. As N can be upto 10^100 digits long in the largest test set, it makes the problem obviously a string manipulation problem and thus the below solution is such.
Worst case run time complexity: O(n) where n is the number of digits in N.


Problem 2: You Can Go Your Own Way
This was a maze problem the solution for which was again written with the time constraints for the largest test set in mind. The solution you want should be no more than O(n^2) complex which was possible with a classic dynamic programming approach to it which I had used. All went well and visible tests got passed but the hit was the hidden test set which was executed post the end of contest where my solution couldn't satisfy the memory constraints. The verdict was Memory Limit Exceeded. It turns out that I have been spendthrift in the memory actually and some optimizations could be deployed to avoid that. I'll up-solve it with a more space-optimal solution for the problem and test it under the practice round but until then, the DP solution is as follows.
Worst case run time complexity: O(N^2) where N is the input - length of one side of the NxN maze.



Congratulations to all those who made it through to the next round! Hope to see you coming out with flying colors! See you at the score board of the hall of fame!!

As always, feel free to point out optimizations or share your suggestions to my approach to the problems shared here. Until then,

Love and Luck,
~glassrose

Saturday, April 6, 2019

Google Code Jam 2019 Qualification Round Underway!

Google Code Jam 2019 Flyer

You don't need any more motivation!

[Stay tuned for my solutions to the Qualification Round on this blog post end of the contest ;) ]

Featured Post

interviewBit Medium: Palindrome Partitioning II

Problem Name:  Palindrome Partitioning II Problem Description : https://www.interviewbit.com/problems/palindrome-partitioning-ii/ Problem Ap...