摘要:
题目: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. E 阅读全文
摘要:
题目: On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and columns are 0 indexed, so 阅读全文
摘要:
题目: Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the 阅读全文
摘要:
题目: Given a string containing only three types of characters: '(', ')' and '*', write a function to check whether this string is valid. We define the 阅读全文
摘要:
题目: 一个花园有N个位置。每个位置上有一朵花。这N朵花会在N天内逐一盛开。每天都一定会有并且只有一朵花盛开,从这天起,这朵花将一直处于盛开的状态。 给定一个由数字1到N组成的数组flowers。数组中的每个数字表示那一天将会盛开的花的位置。 例如,flowers[i] = x表示在位置x上的花会在 阅读全文
摘要:
题目: You are given a data structure of employee information, which includes the employee's unique id, his importance value and his direct subordinates' 阅读全文
摘要:
题目: In this problem, a tree is an undirected graph that is connected and has no cycles. The given input is a graph that started as a tree with N nodes 阅读全文
摘要:
题目: Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie.insert("apple"); trie.search("apple"); // retu 阅读全文
摘要:
题目: Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, suc 阅读全文
摘要:
题目: Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWo 阅读全文