Leetcode: Count Good Nodes in Binary Tree in Python

Count good nodes in a binary tree, according to LeatCode this is Microsoft’s most asked interview question of 2021 so far. 

I think it’s a pretty good problem to understand. A lot of basic Tree fundamental knowledge can be gained from this problem. 

So we’re given the root of a binary tree that is going to always be non-empty. We want to count the number of good nodes in the tree. 

... Read More

Leetcode 1: Two Sum problem – Multiple Solutions in Python

Two Sum problem is considered easy and is frequently asked in Amazon phone interviews. We will see how we can start with a brute force solution and try to improve the code by introducing more data structures.

Problem Statement: Given an array of integers nums and an integer target return indices of the two numbers such that they add up to target

Our aim will be to reduce time complexity and space complexity.

... Read More