欢迎来到PJCK的博客

随笔分类 -  Algorithm Problems

上一页 1 2 3 4 5 6 7 ··· 11 下一页
摘要:You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rota 阅读全文
posted @ 2019-05-01 10:29 PJCK 阅读(177) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-04-29 20:32 PJCK 阅读(97) 评论(0) 推荐(0)
摘要:In a binary tree, the root node is at depth 0, and children of each depth knode are at depth k+1. Two nodes of a binary tree are cousins if they have 阅读全文
posted @ 2019-04-28 22:42 PJCK 阅读(180) 评论(0) 推荐(0)
摘要:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For 阅读全文
posted @ 2019-04-28 20:17 PJCK 阅读(123) 评论(0) 推荐(0)
摘要:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文
posted @ 2019-04-28 18:26 PJCK 阅读(137) 评论(0) 推荐(0)
摘要:Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The length 阅读全文
posted @ 2019-04-28 17:35 PJCK 阅读(158) 评论(0) 推荐(0)
摘要:Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another ar 阅读全文
posted @ 2019-04-28 17:15 PJCK 阅读(173) 评论(0) 推荐(0)
摘要:Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1or 0. Example 1: 阅读全文
posted @ 2019-04-27 23:13 PJCK 阅读(148) 评论(0) 推荐(0)
摘要:Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the most significant d 阅读全文
posted @ 2019-04-26 21:39 PJCK 阅读(125) 评论(0) 推荐(0)
摘要:Given an n-ary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example, given a 3-ary tree: 阅读全文
posted @ 2019-04-26 19:17 PJCK 阅读(151) 评论(0) 推荐(0)
摘要:Given an n-ary tree, return the postorder traversal of its nodes' values. For example, given a 3-ary tree: Return its postorder traversal as: [5,6,3,2 阅读全文
posted @ 2019-04-26 19:15 PJCK 阅读(247) 评论(0) 推荐(0)
摘要:Given an n-ary tree, return the preorder traversal of its nodes' values. For example, given a 3-ary tree: Return its preorder traversal as: [1,3,5,6,2 阅读全文
posted @ 2019-04-26 19:12 PJCK 阅读(154) 评论(0) 推荐(0)
摘要:Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest le 阅读全文
posted @ 2019-04-26 18:44 PJCK 阅读(112) 评论(0) 推荐(0)
摘要:Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only 阅读全文
posted @ 2019-04-26 16:07 PJCK 阅读(199) 评论(0) 推荐(0)
摘要:Given a binary tree, return the postorder traversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iterative 阅读全文
posted @ 2019-04-26 13:18 PJCK 阅读(95) 评论(0) 推荐(0)
摘要:Given a binary tree, return the inorder traversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iteratively 阅读全文
posted @ 2019-04-26 13:13 PJCK 阅读(86) 评论(0) 推荐(0)
摘要:Return any binary tree that matches the given preorder and postorder traversals. Values in the traversals pre and post are distinct positive integers. 阅读全文
posted @ 2019-04-26 10:35 PJCK 阅读(200) 评论(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. For example, 阅读全文
posted @ 2019-04-26 09:12 PJCK 阅读(152) 评论(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. For example, 阅读全文
posted @ 2019-04-26 09:09 PJCK 阅读(187) 评论(0) 推荐(0)
摘要:Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Example 2: 阅读全文
posted @ 2019-04-25 19:37 PJCK 阅读(173) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 ··· 11 下一页