Question

Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree.

A height-balanced binary tree is a binary tree in which the depth of the two subtrees of every node never differs by more than one.

Example 1:


Question

Given a binary tree, determine if it is height-balanced.

For this problem, a height-balanced binary tree is defined as:

a binary tree in which the left and right subtrees of every node differ in height by no more than 1.

Example 1:

Example 2:


Question

Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum.

A leaf is a node with no children.

Example 1:

Example 2:


Today I’ll cover 2 questions because they look pretty similar to me even though looking for opposite results. But the solution will have something in common.

Question 1

Given the root of a binary tree, return its maximum depth.

A binary tree’s maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

Example 1:

Solution

I found using recursive functions with binary trees is really helpful and allows you to cover all branches. This question actually has a one-line solution, but let’s break it down.

We…


Question

Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).

Example 1:

Example 2:


While reviewing one of the job descriptions I’ve come across a coding language that got my attention. Go — I knew about the game Go, but never heard anything about coding language by that name. I knew that Go (game) is very complex, and requires strategic thinking and great focus.


I was asked to build a simple HTML contact form, and building a form is an easy task. There are plenty of templates available and I thought, ok I can do it.

We fill out so many different forms online every day, but we rarely think about how it works. As a developer I needed to think about data, how would data from the form get to the site owner.

Usually, the form would store data in the database and then the site owner can access and manipulate stored data. In this case, there is no website, and HTML form…


The time has come to get my own portfolio website

I’ve been waiting for a long time to start building my portfolio site. And even though it has been long overdue, I’ve finally started working on it.

To make it look impressive, I got help from a professional and asked my wife to get me few templates. She’s being doing website templates for a very long time and she did some great templates for me. The first part was really easy because it was done by someone else.

I decided that I will use React.js and was thinking if I…


Question

Given the root of binary tree, return the inorder traversal of its nodes' values.

Example 1:

Example 2:

Example 3:

Example 4:

Nick Solonyy

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store