目前分類:Algorithm medium (32)

瀏覽方式: 標題列表 簡短摘要

114Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place.

angledark0123 發表在 痞客邦 留言(1) 人氣()

764Largest Plus Sign

In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the given list mines which are 0. What is the largest axis-aligned plus sign of 1s contained in the grid? Return the order of the plus sign. If there is none, return 0.

angledark0123 發表在 痞客邦 留言(0) 人氣()

785. Is Graph Bipartite?

Given a graph, return true if and only if it is bipartite.

angledark0123 發表在 痞客邦 留言(0) 人氣()

670Maximum Swap

Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.

angledark0123 發表在 痞客邦 留言(0) 人氣()

127Word Ladder

Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:

angledark0123 發表在 痞客邦 留言(0) 人氣()

261Graph Valid Tree

Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree.

angledark0123 發表在 痞客邦 留言(0) 人氣()

337House Robber III

The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. After a tour, the smart thief realized that "all houses in this place forms a binary tree". It will automatically contact the police if two directly-linked houses were broken into on the same night.

angledark0123 發表在 痞客邦 留言(0) 人氣()

116Populating Next Right Pointers in Each Node

Given a binary tree

angledark0123 發表在 痞客邦 留言(0) 人氣()

341Flatten Nested List Iterator

Given a nested list of integers, implement an iterator to flatten it.

angledark0123 發表在 痞客邦 留言(0) 人氣()

621Task Scheduler

Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could be done without original order. Each task could be done in one interval. For each interval, CPU could finish one task or just be idle.

angledark0123 發表在 痞客邦 留言(0) 人氣()

56Merge Intervals

Given a collection of intervals, merge all overlapping intervals.

angledark0123 發表在 痞客邦 留言(0) 人氣()

139Word Break

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. You may assume the dictionary does not contain duplicate words.

angledark0123 發表在 痞客邦 留言(0) 人氣()

236Lowest Common Ancestor of a Binary Tree 

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.

angledark0123 發表在 痞客邦 留言(0) 人氣()

17Letter Combinations of a Phone Number

Given a digit string, return all possible letter combinations that the number could represent.

angledark0123 發表在 痞客邦 留言(0) 人氣()

92Reverse Linked List II

Reverse a linked list from position m to n. Do it in-place and in one-pass.

angledark0123 發表在 痞客邦 留言(0) 人氣()

173Binary Search Tree Iterator

 

angledark0123 發表在 痞客邦 留言(0) 人氣()

 29Divide Two Integers

Divide two integers without using multiplication, division and mod operator.

angledark0123 發表在 痞客邦 留言(0) 人氣()

33Search in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.

angledark0123 發表在 痞客邦 留言(0) 人氣()

3Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.

angledark0123 發表在 痞客邦 留言(0) 人氣()

 

162. Find Peak Element

angledark0123 發表在 痞客邦 留言(0) 人氣()

1 2