摘要:
Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you solve it without using extra space? 阅读全文
摘要:
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? tags提示:two pointers 采用“快慢双指针”的方法来判断: 每次 阅读全文
摘要:
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 complet 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime 阅读全文
摘要:
Given an array of integers, every element appears twice except for one. Find that single one. Your algorithm should have a linear runtime complexity. 阅读全文
摘要:
Given inorder and postorder traversal of a tree, construct the binary tree. You may assume that duplicates do not exist in the tree. 阅读全文
摘要:
Given preorder and inorder traversal of a tree, construct the binary tree. You may assume that duplicates do not exist in the tree. 阅读全文
摘要:
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and 阅读全文