How to Pass Amazon Interview

Introduction

Before you can sit for the onsite exam, you must pass the amazon coding interview. Please check this blog on how to pass the amazon coding test.

I was able to successfully pass the Amazon exam in my second attempt. It was a very challenging and refreshing experience. In this blog, I am sharing what I did to prepare for the exam.

Interview Structure

The on-site interview has four separate interview sessions, done by four individual interviewers. Each interview should take about 55 minutes.

Out of four interviews, three will be algorithmic questions. One will be a system design question.

Algorithemic Questions

For Algorithemic questions, you will have to write your code on a paper or on a whiteboard. You can use any programming language. You will have to provide the runtime and/or memory complexity of your program. You will have about 40 minutes to finish your question. If you complete it early, the interviewer may ask you a different question.

Design Question

Same goes for the design question. You have to draw the design diagram on the paper/whiteboard and explain your question to the interviewer. Similarly, you will have about 40 minutes to complete the question.

Leadership Questions

Amazon is very serious about its leadership principles. At the end of each interview, you will be asked some questions about Amazon Leadership Principles. This will take about 10 – 15mins.

Preparation – Algorithms

Basically, follow the same set of preparations that I described here for the coding exam.

Preparation – Design Question

Design question can be very challenging because of the ambiguous nature of it.

These questions can be of two flavors. Either it can be a very high-level question like “Design the Netflix”. Or it can be quite a low-level question like “Give me a class diagram for a Table”. So either you are designing a very complex system with high granular modules. Or you are designing a very simple system with very modules with low granularity.

To prepare for this exam again you have to practice a lot. Do sample amazon design questions available online. Try to glance through SOLID Design principles. Key to pass this interview is to be able to justify your design trade-offs to the interviewer. You don’t have to present your solution with AWS, or any cloud solutions for that matter. Use whatever technologies you are familiar with should do.

Preparation – Leadership Principles

You can read about the leadership principles here. Read each one of them and try to absorb the essence of every principle. Then try to think about your past experiences where you had to apply these principles. I recommend you to prepare two examples for each of the leadership principles from past experiences.

During the Interview – Think Out Loud

Always maintain good communication with the interviewer. Ask questions regularly. Also, try to think out loud. Explain your thought process to the interviewer. For a particular question if you can think of two or three solutions, explain all the solutions to the interviewer. And tell him what you think the best solution and why.

Make Assumptions

If the questions are ambiguous, clarify all the ambiguity with the interviewer. You may be able to make some assumptions to simplify the problem. If you are going to make any assumptions, tell it to him.

Use Language Provided APIs

You can use any language-provided library for the algorithmic questions. This is highly encouraging because it saves your valuable time. But if you are going to use any API / Data structure, you should be able to explain the interworking of them to the interviewer probably with the complexity.

Leadership Questions

For leadership questions, you will be asked about one of your past experience. And you will be asked lots of questions from different angles of the situation. It will be very hard to maintain a lie; so be honest and truthful.

One Screwup Doesn’t Matter Much

Also, all interviewers have a vote on you. So if you screwup one interview, don’t give up. Give your best shot to remaining interviews.

Other Recommended Readings

https://www.linkedin.com/pulse/20141120061048-6976444-ace-the-coding-interview-every-time/?trk=mp-reader-card

 

Automate Reboot and Git push with Linux Crontab

1200px-Tux.svg

Introduction

I am going to explain how you can set up daily git pushes with crontab command.

Step 1 – Disable git username/password prompt during check-in

Follow the steps on this StackOverflow post.

Step 2 – Add git commands to a sh file

Add following sh file to the repository root directory.

#!/usr/bin/expect

#Pull remote repository
git pull

#Git commit and push
git add -A

#Commit
git commit -a -m "Daily Update"
git push

Step 3 – Open Crontab

sudo crontab -e

Step 4 – Setup Daily Executions

Add following line to the crontab file. This will run the script every 8am in the morning.

0 8 * * * PATH_TO_YOUR_SH_FILE

For example, the command I used was this.

0 8 * * * /home/myhome/project/gitpush.sh

Step 5 – Setup Daily Reboot

Refer to this askUbuntu post to set this up.

 

Set up Ubuntu Mate on Raspberry PI for Python Developers

Raspi-PGB001

Introduction

This blog explains how to set up a freshly installed Ubuntu mate on a Raspberry PI for Python and Django development. If you want to know how to install Ubuntu Mate on Raspberry PI please refer to this post.

Step 1 – Enable SSH

Not really needed for this task. But handy to have it. Run the following two commands to activate it.

sudo systemctl enable ssh
sudo systemctl start ssh

Step 2 – Update Ubuntu

Run following two commands. These two will take 1-2 hours to finish.

sudo apt-get update
sudo apt-get upgrade

Step 3 – Install Importent Packages

sudo apt-get install git
sudo apt install vim

Step 4 – Install Python/Django

sudo apt install python-pip -y
pip install --upgrade pip 
sudo python -m pip install django

Best Machine Learning / Data Science Reads

Here are the most interesting research papers / articles that I came across.

  1. A Few Useful Things to Know about Machine Learning. This papers discusses twelve important topics that every machine learning practitioner should pay his attention to. https://homes.cs.washington.edu/~pedrod/papers/cacm12.pdf
  2. This article describes foundations of algorithmic bias. http://approximatelycorrect.com/2016/11/07/the-foundations-of-algorithmic-bias/
  3. How machine learning algorithms are evaluated in real world uses in web and other online applications. https://ai.stanford.edu/~ronnyk/2007GuideControlledExperiments.pdf

Investing Guide for Solo Investors

invest

Seven Key Rules

Keep following seven rules on your mind, on your desk and on the wall of your bedroom if possible. Read them at least once a week. When you are making an investment use this rules to evalute the quality of the investment.

  1. Always try to minimize loosing money. This involves making investments with minimal downside risks.
  2. Focus on acquiring and holding stocks with consistent dividend growth so the revenues can be compounded.
  3. Stocks are never undervalued. Stock is today worth what investors willing to pay for it, no more no less.
  4. No more than 20 symbols. Hard to keep track more than 20 companies. At least Half of them with high dividend pay companies.
  5. Evaluate each investment twice an year
  6. Have a predefined exit criteria for all the holdings.
  7. Always have a pool of cash ready

Numbers to Consider

  1. Company should have a high dividend yield. At least higher than the inflation.
  2. Consistent, moderate dividend growth – High dividend growth rates are not sustainable. Financial statements can be deceptive. Executives work goes to make them attractive for investors. But the dividend payment always tell the truth. Consistent growth of dividends is the hallmark of a good company. See at least 5 years of history.
  3. Debt / Capitalization should be less than 50%
  4. Coverage of at least 3 : 1. Cash flow of the company after taxes should be at least three times as the interest it pays
  5. Consistent, moderate annual earning growth 5 – 10%
  6. Payout ratio less than 60%
  7. Low Price / Sales ratio – Price of a share divided by the sales per share. Very fist prerequisite of business is revenue. If  revenues are high compare to the stock price, profitability can be easily increased though cons controls and increased productivity. Minimum price to sales ration of 1.5.
    1. Low P/E Ratio – must be at minimum. This value should be less than the reciprocal of the long-term bond rate. If bond rate is  5% –> 100 / 5 = 20 –> PE value should be less than 20. If the price of the company is above this level. Then the stock is expensive. Evaluate the PE value of a stock relative to the PE value of the market. If a stocks PE has been 125% of the market, but now it sells at 80% of the market, there is a good chance that it is under valued at the moment.
  8. Buy shares less than it’s book value. Book value does not represent intangible values of the company such as the brand name.
  9. Growth in cash reservers or investments made by the company
  10. Less volatile sharp rice. Can calculate the standard deviations of the share price to find this.

Measurements of the Quality

  1. Company has Performed well during the troublesome economic environments
  2. How well acquisitions are absorbed and integrated into the company –> smart acquisitions
  3. Do best to avoid new businesses. Look for companies with long-term consistent moderate growth, long-term dividend yields, long-term growth of yield.
  4. Look for a company that produce real goods or services which serves peoples needs, has a reliable user demand. Avoid reseller companies.
  5. What you should really buy is a competitive advantage. Try to identify the competitive advantages a company has over others.
  6. Look for growth kickers. That could be selling for a low performing division or a new sub division with great potential

General Guidelines

  1. Information available to everyone is not valuable anymore. PE ratio is not valuable as it was before
  2. TIme of max optimism is the best time to sell. the time of max pessimism is the best time to buy
  3. Don’t confuse genius with a bull market
  4. A list of stocks that you want to earn but which are not representing correct value at the moment. use this list during next correction/crash to buy

 

Selling Strategy

Sell when the dividend does not make sense to hold it for long team. make the decision based on the dividends. If we know that dividends are not going to keep rising, then it is time to sell. When dividends are affected, so is the share price.

Also when the share price increases it’s fair value, and the dividend yield relatively smaller to the other shares

One year goes with dividend increase. See the reason is one time occurring. If it fails two consecutive years, may be it is a good time to sell.

Document selling decisions and analyze them annually

If a company grows really fast with keep increasing sales, if those sales comes from the consumer credit, that may not be a sustainable business. When the debt cycle turns, customers will not be able to consume services as often.