Description:

# [Leetcode 20] Valid Parentheses

Description:

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

An input string is valid if:

1. Open brackets must be closed by the same type of brackets.
2. Open brackets must be closed in the correct order.

Example…

# [Leetcode 693] Binary Number with Alternating Bits

Description:

Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.

Example 1:

Example 2:

Example 3:

Example 4:

Example 5:

Constraints:

• 1 <= n <= 231 - 1

C code solution:

# [Leetcode 617] Merge Two Binary Trees

Description:

You are given two binary trees root1 and root2.

Imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge the two trees into a new binary tree. The merge rule…

# [Leetcode 190] Reverse Bits

Description:

Reverse bits of a given 32 bits unsigned integer.

Example 1:

Example 2:

Constraints:

• The input must be a binary string of length 32

C code solution:

Insertion Sort:

# [Leetcode 700] Search in a Binary Search Tree

Description:

You are given the root of a binary search tree (BST) and an integer val.

Find the node in the BST that the node’s value equals val and return the subtree rooted with that node. If such a node does not exist, return null.

Example 1:

# [Leetcode 701] Insert into a Binary Search Tree

Description:

You are given the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of the BST after the insertion. It is guaranteed that the new value does not exist in the original BST.

Notice that there may exist…

## Samuel Liu

Hi I am Samuel

Get the Medium app