随笔分类 -  algorithm

上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页
摘要:Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up:Can you 阅读全文
posted @ 2017-11-23 02:00 逸朵 阅读(116) 评论(0) 推荐(0)
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
posted @ 2017-11-22 06:24 逸朵 阅读(101) 评论(0) 推荐(0)
摘要:Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note:Your algorithm sh 阅读全文
posted @ 2017-11-22 05:51 逸朵 阅读(113) 评论(0) 推荐(0)
摘要:Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled 阅读全文
posted @ 2017-11-22 05:20 逸朵 阅读(165) 评论(0) 推荐(0)
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning 阅读全文
posted @ 2017-11-22 04:00 逸朵 阅读(130) 评论(0) 推荐(0)
摘要:Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in 阅读全文
posted @ 2017-11-22 02:15 逸朵 阅读(147) 评论(0) 推荐(0)
摘要:Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, 阅读全文
posted @ 2017-11-21 13:09 逸朵 阅读(171) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2017-11-20 12:38 逸朵 阅读(101) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2017-11-20 12:31 逸朵 阅读(136) 评论(0) 推荐(0)
摘要:Given a string S and a string T, count the number of distinct subsequences of S which equals T. A subsequence of a string is a new string which is for 阅读全文
posted @ 2017-11-20 12:04 逸朵 阅读(133) 评论(0) 推荐(0)
摘要:Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in th 阅读全文
posted @ 2017-11-20 11:32 逸朵 阅读(146) 评论(0) 推荐(0)
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文
posted @ 2017-11-20 09:28 逸朵 阅读(142) 评论(0) 推荐(0)
摘要:Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 阅读全文
posted @ 2017-11-20 09:12 逸朵 阅读(116) 评论(0) 推荐(0)
摘要:Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, return [3,2,1]. 阅读全文
posted @ 2017-11-20 05:30 逸朵 阅读(140) 评论(0) 推荐(0)
摘要:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 whic 阅读全文
posted @ 2017-11-20 05:06 逸朵 阅读(133) 评论(0) 推荐(0)
摘要:Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution sti 阅读全文
posted @ 2017-11-20 03:35 逸朵 阅读(125) 评论(0) 推荐(0)
摘要:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its ne 阅读全文
posted @ 2017-11-20 02:53 逸朵 阅读(126) 评论(0) 推荐(0)
摘要:Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. Given inorde 阅读全文
posted @ 2017-11-20 02:41 逸朵 阅读(150) 评论(0) 推荐(0)
摘要:Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 阅读全文
posted @ 2017-11-20 02:32 逸朵 阅读(96) 评论(0) 推荐(0)
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example:Given the below binary tree and sum 阅读全文
posted @ 2017-11-18 05:27 逸朵 阅读(133) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页