# Construct String from Binary Tree

Today I picked up a random problem from Leetcode, as an easy exercise for a rainy Sunday. And, spoiler alert, it’s about one of my most favorite topics — Tree. So here we go.

You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way.

The null node needs to be represented by empty parenthesis pair “()”. And you need to omit all the empty parenthesis pairs that don’t affect the one-to-one mapping relationship between the string and the original binary tree.

`Input: Binary tree: [1,2,3,null,4] 1 / \ 2 3…`

# 3rd Tet away from home

Let me tell you few things about myself.

I am a Vietnamese girl, born and raised in Vietnam. I successfully made my escape from my country by marrying a Spanish man, and right now I am living in one of the coolest cities in Europe — Barcelona.

I’m just kidding. I didn’t escape from my country. We do not have war nor slavery. …

# Our two kids

I am 29 almost turned 30. I have one husband and two kids.

One of them named Bob. I know, weird name. He almost reaches two years of age. He is quite introverted, doesn’t like strangers and he warms up slowly. He used to spend time alone without being annoyed by others. He likes to sleep and can sleep a lot during the day. He is quite picky with food. There was a time when we were getting really worried because he wouldn’t want to eat anything. Now, he is still picky but is willing to eat few things that…

# Find First And Last Position of Element in Sorted Array

This is the first post on my series of Leetcode solutions. I would try to explain my solution as clearly as possible. Some of my solutions might not be as optimized as others. Thus, constructive criticism would be highly appreciated.

Given an array of integers `nums` sorted in ascending order, find the starting and ending position of a given `target` value.

If `target` is not found in the array, return `[-1, -1]`.

• The array is already sorted in ascending order. This means that we only need to iterate through the array once.
• Initiate the result array with values as [-1…

# Why I chose Leetcode

The professionals always say that in order to sharpen your algorithm problem-solving skills, the best way is to keep practicing. It’s true not only for beginners but also professionals as coding is always a part of the interview processes for any developing or engineering-related positions. You can start by doing three exercises per week if it takes you almost the whole afternoon trying to solve a problem, or if you are motivated enough, one every day would be perfect.

At the beginning of my learning curve, I did quite a lot of Hackerrank but recently have turned to Leetcode. They…

# Quick application deployment with Heroku

So you are a beginner, maybe self-taught like myself, after having loaded your brain with tons of new concepts and theories, you’ve decided that it’s time to start your own project, something that you can actually see and feel (you know what I mean). You’ve found some short courses or quick tutorials that show you how to create your first application. You can finally make something that is different from reversing a string or traversing a tree, something… real. You now can run your application on a local machine and see what’s actually like. But after that, you’re getting more…

# Reverse a string with recursion

One of the first things you need to know when learning programming is the recursion algorithm. Recursion is basically a function that keeps calling itself until it reaches a base case. A base case is a simple condition for the function to return a value.

Most beginner programmers like myself would find it hard to wrap their heads around the idea of recursion since it requires another way of thinking. Let’s take a look at one of the most common applications of recursion — reverse a string. …

# Binary Search Tree

A Tree is one of the most commonly used data structures among others.

“ A data structure that stimulates the hierarchical tree structure, with a root value and subtrees of children with a parent node, represented as a set of linked nodes. “

Souce: Wikipedia

The topic of today is Binary Tree. So a binary tree has a similar structure to a general tree but a parent node of a binary tree has no more than two children. This makes operations like inserting a new element or searching for a value in the tree become less complicated.

Geeksforgeeks.org clarifies the…

## My Linh Tran

Get the Medium app