This is going to be very short and precise article on how to setup you macbook pro with java and maven.

Now macbook is coming default with zsh shell.

Steps for Java setup:

— — — — — — — — — — — — — — — — —…

I came across these two questions and found similarities.

- Buy and Sell only 1 time to get maximum profit.
- Buy and Sell multiple times to get maximum profit.

Here comes the solutions for the same, The code is the same for both the questions but with minor differences.

Solution 1…

This is a good question, So decided to solve it.

Given two sorted arrays, such that the arrays may have some common elements. Find the sum of the maximum sum path to reach from the beginning of any array to end of any of the two arrays. We can switch…

This is marked as Hard on the geek's platform.

Given an odd integer n, find a matrix of size n x n with the following conditions:

- Each cell contains an integer from 1 and n (inclusive).
- No integer appears twice in the same row or the same column.
- All 1’s…

This question is based on ladder and stairs, We need to find the minimum number of jumps to reach the end.

Here we will follow few steps:

- initialize stairs and ladder as the first element of the array.
- Keep track of the maximum ladder we got as of now.
- decrease…

This question is similar to check if two trees are symmetric or not.

https://leetcode.com/problems/subtree-of-another-tree/

Given two **non-empty** binary trees **s** and **t**, check whether tree **t** has exactly the same structure and node values with a subtree of **s**. A subtree of **s** is a tree that consists of a…

I came across these 2 questions and found a similarity in the logic part.

- Symmetric Tree:

We need to check symmetry for the same tree or say mirror image.

**Input:**

5

/ \

1 1

/ \

2 2

Output: True

Explanation: Tree is mirror image of

itself i.e. …

I came across these 2 questions and found similarities in both of them.

Now, let's discuss the solution:

- Check for a balanced tree:

**Input:**

10

/ \

20 30

/ \

40 60

**Output:** 1

Explanation: The max difference in height

of left subtree and right subtree is 1. …

Recently I study the topic and sharing the notes for the same.

Inner Classes

Without existing one type of object if there is no chance of existing another type of object then we should go for inner classes. …

I came across this question in an interview recently for the SDE-2 position.

There is a shop with old-style cash registers. the price of each item is typed manually. Given a list of items and their correct prices, compare the prices to those entered when each item was sold. …