Table of contents

System Programming 

Basics of Kernel
All about Grep commands
Compiler Cheat Sheet
C Cheat Sheet
C++ Cheat Sheet
Bitset in C
Shell Programming Cheat Sheet
Special features of C language
C++ basic concepts
Technical phone interview questions
Mercurial commands

Algorithm and Data Structures

Find White Spaces in Character Array
Find a character in the String
Number is prime or not
Finding Absolute Value
Notes on Sorting and Searching Algorithms
Common String Functions
Reverse a String
Product of all array location expect its own
Find a cycle in the Linked List
Find a binomial co-efficient
Counting sort algorithm
B-Tree
Find product of all locations in an array expect self

Java

Java Concepts
Java String concepts
Immutable classes in Java
Remove duplicates from the array
Telephonic phone technical interview questions
Telephonic phone technical interview questions - Part 2
Serialization & Deserialization
Jersey Package Dependencies
Observable and Observer Interface
Servlet Filter
Servlet Client Request
Spring dependencies for Maven
Java String Operations

Front End

CSS3

Gradients in CSS3
Radius Property of CSS3
2D transform in CSS3
Transition Property in CSS3
Animation in CSS3
CSS properties
Text properties in CSS3

Javascript and jQuery


Product Management

Management Concepts
Questions on Wireframes
Common Design Questions
List of Puzzles
List of Behavioral Questions
MySQL
Behavioral Question and Answers
Product Manager Estimation Questions

Miscellaneous 

Must Read list

Must Read List

Automate the boring stuff with python
Python is a versatile language and it pays to learn it. Most of the manual tasks can be automated via python and new functionalities can be implemented easily. Above link is a book that will help you learn it easily.

Python Tricks
A great article to learn some cool tips and tricks in python.

Web Security
Nice article to learn some basics of Web Security.


Product Manager Estimation Question: Exercise #1

If you are opening a new Walmart store, how would you decide how many cash register is needed for the store?

There are basic steps to solve this problem. They are:

  1. Ask any clarifying questions. Work with interviewer to define the scope. 
  2. Create a main equation such as a = b * c. Divide the equations into sub parts. 
  3. Think of any edge cases. 
  4. Calculate the numbers and do a sanity check.
Starting with steps:
Questions and Answers by the candidate. 
Questions and Answers by the interviewer. 

Ask clarifying questions to define the scope of the problem:
  • Do we know if this walmart is in a suburb or city? Suburb 
  • Do we know if there are any other walmarts in the neighborhood? Yes two more. 
  • Are they closer to this suburb? No. Both of them are far. 
  • Ok so in that case, many of the residents will rely on this Walmart. Yes
  • Can we assume that any person is ok with waiting at the register for 4-8 mins? Yes

Create the main equation:
Number of registers = Number of people visiting the store/time taken at each register. 

Break down the equations into simple sub-equations: 
  • Two main components are: Number of people visiting the store. 
  • Time taken at each register: 4-8 mins as clarified. 
  • So we need to focus on number of people. Basically only a certain set of people visit the store so we can say x% of entire population visit the store. 
  • Since we have no way of telling what is x but given that Walmart is popular choice of lower to upper middle class. We can safely assume that x=65-70% people visit Walmart because of their low prices. 
  • Since its a suburb whose size we don't know, we are going to estimate. 
    • US average population is 325 million. We will round it to 300 million for easier calculations. 
    • Based on some stats I know that:
      • 26% population live in urban areas
      • 51% in suburban
      • 21% in rural
    • Majority of population is living in suburban. Estimated number is 150 million live in suburban.
    • There are 50 states in USA. We can assume that each state has 50-60 suburbs and bigger ones will have 65-80 suburbs. So average is 60(round off) suburbs in each state. So total suburbs are around: 50*60= 3000 = 3k
    • So 150 million people live in 3k suburbs. And on average 50k people live in 1 suburb. 
    • Only 65%(as assumed)of 50k go to Walmart. But they go as a family. So we don't need to calculate all the people. We need to calculate the households. 
    • We can assume that each household has approximately 3 people. This brings down our number of people to 16k users. 
    • And not all the people are at the walmart at the same time. We can say at any time only 5% of people are at a walmart = 5% of 16k = 800 approximately. 
    • Now not everyone is checking out at the same time. Let's say only 30% of them are. this brings down the number to 240.
    • And not all 240 has shopping carts, they are with their families. Let's say each group has 2 people ~ 120 are in line. 
Calculate the numbers and do a sanity check:
  • Equation: Number of registers = Number of people visiting the store/time taken at each register. 
  • Sub equation: Number of registers = (x% of total population visit the store)/time taken at each register. 
  • x% of total population that visit the store and are doing a checkout during busiest times are = 120
  • Average time taken at each register = 6 minutes. 
  • So total registers = 120/6 = 20
  • Sanity check: At a walmart, I have seen 15-20 registers and our answer is 20. So this is in the ballpark number. 

Final answer is = 20 registers.

Some background: 
  • Initially I assumed 30 suburbs in each state. The count came down to 100 million people in each suburb. This is a lot. San Jose's population is 1 million. So I went back and changed the number of suburbs to 60 per state. This helped with some corrections. 
  • I assumed 30% of suburbs population is in Walmart at any given time. Again this is a huge number. So fixed it to 5%. 
  • Then assumed 50% of them are checking out at the same time so fixed it to 30% as well. 

Let me know your thoughts and let me know in comment section on how you will solve this problem. 





Quick Cheatsheet on some Javascript Basics

1) Global objects can be accessed via this operator in javascript.

2) Global properties that return a simple value and have no methods are:
Infinity, NaN, undefined, null

3) How to create a variable:
var myNameVariable = ‘name1’;
//Re-assigning the value:
myNameVariable = ‘name2’;

4) Primitive data types that are supported in Javascript are:
Boolean, Null, Undefined, Number, String, Symbol, Object
  • Boolean type can take true or false
  • Null can take exactly one value: null
  • Integers are 16-bit unsigned integer values
  • Object: It's like an object oriented programming concept of object.
5) Comments: Following are 2 types of creating comments.
  • /* */
  • //
6) Mathematical operators:
  • add/concatenation: +
  • subtract: -
  • multiple: * 
  • divide: /
  • assignment operator: =
  • Identity Operator: ===
  • Negation: !
  • Not equal: !==
7) How to define a function
function testFunc() {
alert(“Test”);
}

Behavioral Questions and Answers

Which do you like first, the good news or the bad news? 
I like good news first. It will elate my mood so I will be able to take bad news better. If I get bad news first that I might miss the gravity of the good news.


Have you been in a situation where the team has let you down and you've to take the blame?
Yes it has recently happened. I provided reqs to engineering about a product feature. They were supposed to send out data of certain time period. Instead they sent out data for a longer period. We realized it when we received our invoices and they were higher than usual. Now there is no point blaming them but to own it up. I did bring it up with the engineering team and requested them to stick to the requirements.
As a fallback mechanism, I added a QA process for all the outgoing data. I had a rough estimate of numbers that can be sent out for all new requests. So for every new request, I asked them to provide me with the total size. If it matched or was within a specific range, we went ahead with sending out the data. This happened for only new requests so we didn't had to worry about them providing me with updates all the time since subsequent similar requests were automated.


How has your tolerance for mistakes changed over the years?
It has increased a lot. I have realized that people will make mistakes all the times and most of the times, they are genuine. There is no point getting upset over honest and genuine mistakes. And some people does mistakes because they don't know any better. For ex: Kids are just being kids, no point getting upset/angry at them when they are being themselves. New hires might deploy a bug in the production, it will not be productive if we start doubting them. So bottomline is: Mistakes will happen, we just need to learn from them and move on. However I am careful when someone conducts same mistakes over and over again. Now that is being careless and would hurt a business in a professional setting. Such behavior should be addressed in timely manner before the person becomes habitual of mistakes.


What have you learned about saying no?
It is a very important skill to have. And you can't say no to all the audiences. But to whosoever I am saying it to, I make sure that I say it nicely and precisely.
  • Recently I got a project request from Engineering. They wanted to prioritize an infrastructure project over a revenue generating one. Now infrastructure is important but not over revenue. I requested information on how they were planning to impact the revenue via it and they didn't come up with solid backing. The project would have added stars to the engineering manager's profile but wouldn't have generated any revenue for the company. Based on preliminary analysis, I politely said no and suggested them to get a budget approval from their Execs to move forward. But Product was not ready to buy the idea at the moment. I suggested to talk to my manager and exec level if they thought so strongly about it. They didn't so we didn't moved ahead with the project. 
  • We get a lot of feature requests that are one time use. Now we want our users to be honest to us but we can't tell them no on the face directly. We ask them for ROI on these features and its apparent that those features are not going to be extensively used for a lot of projects. One project that might not see the light of the day requires such features but we can't commit all our resources to build something that is not showing a lot of promise. 
  • And in product management you'll have to say no a lot then yes. If you say yes to everything then you will busy executing someone's vision and not your vision of the product. Trying to understand the impact or ROI is best way to weed out must haves from good to have features. 

Do you manage people from different functions differently? If so, how? 
Yes I do. Exec level is way different from Customer/user and that is different from Engineering or Legal or Procurement or Finance.
  • Exec level wants to know more about strategy and Product vision. They care about numbers with focused plan, about business goals, product goals, KPIs. 
  • Engineering cares about how well the Product fits in the vision. If it is high visibility product or a supporting product. What technology to use? What technology is used by integrating partners? How to integrate well to improve the performance? Are the requirements clear enough to build a solid foundation? Is there scope of automation?
  • Legal cares about fine print on the contracts. They want to make sure that business is executed as expected and we are conducting it by adhering to all the rules. 
  • Finance cares about if our product is generating the revenue. How can we decrease cost without affecting performance or any business goals? 
  • Procurement worries about getting the contracts signed to continue the business or initiate a new business quickly. They try to lock down a great deal at a good rate for few years. This way we are not reinventing the wheel all the time and are making sure that the deal is in place so that different functions can focus on achieving the business goals. 
  • Customers/users want to learn about a new feature. Want to know when a specific feature will be available. Will communicate with them to provide hope that their feature is on its way or politely turn them down telling them we are focussing on something else that requires our attention.

What would somebody do to lose your confidence?
Lie to me multiple times and double standards. If I catch someone constantly lying about something then that's it for me. If you lie one time its ok. There might be some reason why you did it. May be you were trying not to hurt me. But lying every time a tough situation comes up or when you are confronted tell me that the person shouldn't be trusted.
Second, if you say one thing in private but something else in public then bye bye.


How do you get a team to commit to a schedule?
  1. Explain them the bigger picture and product/business goals. 
  2. Make them feel that their contribution is making a difference to motivate them. 
  3. Create a roadmap and associate key tasks/stories to different items on the roadmap. 
  4. Define key metrics/KPIs and associate them to the tasks/stories and map. 
  5. Setup a meeting to go over above steps and define the project plan.
  6. Email out the plan with people held accountable to different tasks/stories. 
  7. Check periodically to monitor progress. 
  8. Ensure you are available to help prioritize if competing projects are showing up regularly. 
  9. Ensure to send updates when tasks are completed or are falling behind schedule
  10. Send out emails to key stakeholders once project is completed. 
  11. Celebrate the success!
  12. Document the learnings and measure the metrics and KPIs. 
  13. Refine metrics if need be. 
  14. Iterate.
Tell me about a time when a team didn't gel. Why do you think that happened, and what have you learned? 


What types of people have you found it difficult to work with?
People who never get along with anyone. Anything is a huge task for them. They are just trying to finish off something so quickly and don't want to think through things. Since they are in such a hurry that they resent any new task that is added to their plate. 


What kinds of people do you like to work with?
  • People who like to own the responsibility and don't mind few challenges here and there. A daily challenge might be an issue for many.
  • Those who like learning and are open to teach any acquired skills. 
  • Those who are able to focus on bigger picture while executing day to day activities. 

What's the difference between management and leadership? 
ManagementLeadership
Focuses on just day to day. Involves the team on strategy
and help with the bigger picture understanding
short term thinking Long term thinking
Focuses on onselfFocuses on the team
Not aware of employees goals and long term plansIs aware
Build processes and systemsBuild relationships
DirectCoach

How do you earn the respect of the engineering team as a product manager or someone outside that team?

  1. I usually provide them goals of the projects and how they will impact the revenue.
  2. If its an urgent ask, I try to get hold of someone in Sales or Planning team to understand how much revenue it is going to bring. If I know it, I communicate it to the team.
  3. If we are running an experiment then I am upfront with them by telling them this is just an experiment that might not result in a full blown project. So I tell them to do it in a quick and dirty way. Don't need to think about it and doesn't need to build a solution out of it.
  4. Since I have technical background, I try to communicate in the same language and they are usually comfortable explaining things further.
  5. I am usually polite most of the times. It helps. If I put someone on their plate I make sure other low priority items are moved out.
  6. While writing specifications, I write them out as detailed as possible.
  7. While they are releasing something, I help them out with the plan and am available if they identify a bug and need approval to roll back new features.


You might also like:
List of all behavioral questions

B-Tree

Features:
  1. Its a self balancing tree
  2. All its nodes live in the main memory. 
  3. If the height of the tree is long then nodes are accessed from the disk in the form of blocks. Hence the height is kept low and it reduces the disk access. Disk access time is low compared to AVL trees, Red-Black trees, etc.
  4. All leaves are at same level. 
  5. A factor x is defined that determines number of keys. 
  6. Node may contain 1 key. 
  7. All nodes must contain atleast t-1 keys and atmost 2t-1 keys.
  8. Keys are stored in ascending order.
  9. It grows and shrinks in size unlike BST. 
  10. O(Logn) is for search, insert, and delete.

Search operation:
  1. If key to be searched is x, we start by looking at the root node. 
  2. If x > root then we search RHS of the tree. 
  3. In the node we look for all the values sequentially. If the intended node doesn't has the key then we go back to root, look for next key sequentially present in the root and repeat step 2. 
  4. If x<root then we search for LHS of the tree.
  5. Repeat step similar to 3.
  6. If we don't find the keys in any of the nodes then we return Null.

Traverse operation:

NoSQL

This one is reviewed but I need to delete its copy from hubpages or somewhere NoSQL Data models: key-value  Aggregate model.  key or i...