# Interview Questions

This category contains few tricky questions asked in interviews..

## Factory Method Pattern

It is most likely that you read my previous post on the Misconceptions . If you missed that, then I would advice you to please read that, it is a small post. So, in this post we will learn about few things: What exactly is Factory Method Pattern ? What purpose does it solve? Where in JDK is Factory Method Design Pattern used? Key points of Factory Method Design Pattern. What exactly is Factory Method Pattern Continuing our story from the previous post, where Jay is now happy with his shops and the simple factory setup. As a business grows people see it and try to earn profit f...

## Misconception about Factory Method Design pattern

Introduction This post is intended mostly for beginners who want to understand the Factory Method Design Pattern. Yes! the name is Factory Method Design Pattern and not Factory Pattern. It is very important for me to start with the misconception about Factory Method Design pattern, this is a starter post and you might not learn anything about the Factory Method design pattern here. But yes! I will tell you what is not a factory method design pattern. The story Once upon a time there lived a Carpenter Jay in a village. He had this nice way of making beautiful wooden furniture and he used ...

## Count Triangles formed by the elements of array

Problem Statement Given a sorted array of distinct integers, each of these integers can represent a length. The task at hand is to count the number of possible triangles which can be made through these lengths. Of course, if you chose one length to be one side of the triangle, you cannot use that length again in the same triangle. This means, no triangle contains the same length more than once. Important Note: For given sides of lengths a, b and c. A triangle can only be formed if sum of any two sides is greater than the third side. This is called the triangle inequality. The sum of any...