Introduction
This is the third article in the Tree Traversals - Online Classes.
I have written many articles about non-linear data structures and their traversals. But the more you dive in you can find many more ways to traverse a tree. Here we try to solve the level order tree traversal for a binary tree and we will also try to figure out other variations of this traversal. This can we precisely extended for a n-ary tree as well.
Defining the problem
Let us consider the above tree, if we follow the blue line from root till end and print all the nodes, we will end up printing the lev...

Read More
# Interview Questions

This category contains few tricky questions asked in interviews..

## Interview Question – Sorting Time Strings

Introduction
This is a pretty famous problem asked in most of the interviews, "Sorting the dates". This is not a complicated one but sometimes, it becomes real confusing or starts giving unexpected results, if not properly taken care of. To learn more about similar problems, please visit the Interview Section.
Do not forget to use the Subscribe feature on the right to get updates on new articles.
Problem Statement- Sorting Time Strings
You are given an array of Time objects in which the times are in the following format "13:24:56.123" i.e. "HH:mm:SS.Z" and you need to sort them in ascendin...

Read More
## Dynamic Programming – Minimum Number of Coins

[nextpage title="Introduction"]This is the third post in Dynamic Programming - Online Classes.
This is another article which demonstrates the usage of dynamic programming to solve a different problem in hand. To learn the basics of dynamic programming check my first article on dynamic programming.
Purpose of the post
The purpose of this article is to solve another problem using dynamic programming, this is a very famous interview question which is asked in multiple interviews. So without wasting any time, let us jump into the problem and ways to solve the same.
Find minimum number of coi...

Read More
## Binary Tree – Print all paths in a tree

Introduction
This is the seventh article in the series of non-linear data structures, to read more about the previous article, please check the topic Hierarchical Datastructure – Tree Traversals. To get updates on the coming articles in the series, please use the Subscribe feature on the right panel.
Purpose of article
This article is mostly about using our knowledge of tree to find out ways to solve real world problems and also perform some operations on the tree. We visit the problem to Print all paths in a tree.
Common Operations on a Tree
Here we assume that we already have a tree bui...

Read More
## Dynamic Programming – Longest Common Subsequence

[nextpage title="Introduction"]
This is the first post in Dynamic Programming - Online Classes.
Dynamic programming have been a very interesting topic and technique to solve problems which exhibit a specific set of behaviors. We will try to understand the behaviors and the way it can be implemented to solve complex problem without requiring a mathematical approach. We will try to simplify it to make it clearly understandable and in later articles we will pick up two or three problem statements which can be easily solved using Dynamic Programming.
Purpose of the article
The purpose of thi...

Read More
## Interview Question – Static variables

Introduction
This question was asked in a recent java interview in Goldman Sachs, this isn't complicated but candidates might get confused solving it. This is about static blocks and static variables initialization, so I publish this article under the heading Interview Question - Static variables. To get updates on the other articles in the series, please use the Subscribe feature on the right panel.
Problem Statement
What would be the result when the below code is executed?
[crayon-5a1376ecb1043776782917/]
Solution
What is the approach for solving this question?
Remember your b...

Read More
## Interview Question – Pirate and the Gold Chest

Interview Question – Pirate and the Gold Chest :
Once there were five pirates, each of them equally rational, intelligent and greedy. The pirates can be numbered as P1, P2, P3, P4 and P5 such that P5 has 1 years of service experience, P4 has 2 years of experience, P3, P2 and P1 has 3, 4 and 5 years of experience respectively.
One day they find a chest of 100 gold coins and they decided to divide it among themselves. Everyone being equally greedy wanted maximum profit, so they decided for the following solution:
1) Each pirate will get a chance to propose a distribution rule, and then a ...

Read More