0%

Valid Palindrome II – LeetCode 680

Problem

Description

Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.

Read more »

Longest Continuous Increasing Subsequence – LeetCode 674

Problem

Description

Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).

Read more »

Second Minimum Node In a Binary Tree – LeetCode 671

Problem

Description

Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. If the node has two sub-nodes, then this node’s value is the smaller value among its two sub-nodes.

Given such a binary tree, you need to output the second minimum value in the set made of all the nodes’ value in the whole tree.

If no such second minimum value exists, output -1 instead.

Read more »

Trim a Binary Search Tree – LeetCode 669

Problem

Description

Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might need to change the root of the tree, so the result should return the new root of the trimmed binary search tree.

Read more »

Non-decreasing Array – LeetCode 665

Problem

Description

Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.

We define an array is non-decreasing if array[i] <= array[i + 1] holds for every i (1 <= i < n).

Read more »

Judge Route Circle – LeetCode 657

Problem

Description

Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place.

The move sequence is represented by a string. And each move is represent by a character. The valid robot moves are R (Right), L (Left), U (Up) and D (down). The output should be true or false representing whether the robot makes a circle.

Read more »

Two Sum IV - Input is a BST – LeetCode 653

Problem

Description

Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.

Read more »

Average of Levels in Binary Tree – LeetCode 637

Problem

Description

Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.

Read more »

Sum of Square Numbers – LeetCode 633

Problem

Description

Given a non-negative integer c, your task is to decide whether there’re two integers a and b such that $a^2 + b^2 = c$.

Read more »

Maximum Distance in Array – LeetCode 624

Problem

Description

Given m arrays, and each array is sorted in ascending order. Now you can pick up two integers from two different arrays (each array picks one) and calculate the distance. We define the distance between two integers a and b to be their absolute difference |a-b|. Your task is to find the maximum distance.

Read more »