《算法分析与设计》
文章平均质量分 77
第七夜的雪
这个作者很懒,什么都没留下…
展开
-
《算法分析与设计》Week 1
442. Find All Duplicates in an ArrayDescription:Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements th原创 2017-02-25 21:58:46 · 323 阅读 · 0 评论 -
《算法分析与设计》Week 15
238. Product of Array Except SelfDescription:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of原创 2017-06-04 16:56:37 · 391 阅读 · 0 评论 -
《算法分析与设计》Week 14
2. Add Two NumbersDescription:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain原创 2017-06-04 16:13:13 · 404 阅读 · 0 评论 -
《算法分析与设计》Week 13
145. Binary Tree Postorder TraversalDescription:Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \原创 2017-06-04 16:02:09 · 376 阅读 · 0 评论 -
《算法分析与设计》Week 12
50. Pow(x, n)Description:implement pow(x, n).Solution:一、题意理解 题意很简单,就是自己实现一个幂函数pow(x,n),即计算x的n次方。这里x是浮点型,n是整型。二、分析 1、幂次是整型的情况下,可以分为两种情况,一种n是负数,一种n是非负原创 2017-06-04 15:41:56 · 466 阅读 · 0 评论 -
《算法分析与设计》Week 11
116. Populating Next Right Pointers in Each NodeDescription:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next;原创 2017-06-02 21:43:29 · 331 阅读 · 0 评论 -
《算法分析与设计》Week 10
74. Search a 2D MatrixDescription:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sor原创 2017-06-02 21:26:46 · 333 阅读 · 0 评论 -
《算法分析与设计》Week 19
287. Find the Duplicate NumberDescription:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must e原创 2017-06-04 20:23:33 · 420 阅读 · 0 评论 -
《算法分析与设计》Week 18
155. Min StackDescription:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes t原创 2017-06-04 18:26:10 · 391 阅读 · 0 评论 -
《算法分析与设计》Week 17
367. Valid Perfect SquareDescription:Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in libra原创 2017-06-04 18:01:58 · 459 阅读 · 0 评论 -
《算法分析与设计》Week 9
84. Largest Rectangle in HistogramDescription:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle i原创 2017-04-20 21:51:09 · 391 阅读 · 0 评论 -
《算法分析与设计》Week 8
96. Unique Binary Search TreesDescription:Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5原创 2017-04-19 21:58:38 · 489 阅读 · 0 评论 -
《算法分析与设计》Week 3
148. Sort ListDescription:Sort a linked list in O(n log n) time using constant space complexity.Solution:一、题意理解 给链表排序,要求O(nlogn)时间复杂度和O(1)的空间复杂度二、分析 1、对链表原创 2017-03-25 22:01:27 · 294 阅读 · 0 评论 -
《算法分析与设计》Week 6
455. Assign CookiesDescription:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed fa原创 2017-03-31 16:55:25 · 492 阅读 · 0 评论 -
《算法分析与设计》Week 5
513. Find Bottom Left Tree ValueDescription:Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Exa原创 2017-03-30 11:31:52 · 516 阅读 · 0 评论 -
《算法分析与设计》Week 4
310. Minimum Height TreesDescription:For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible root原创 2017-03-29 22:14:19 · 514 阅读 · 0 评论 -
《算法分析与设计》Week 7
338. Counting BitsDescription:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and retur原创 2017-04-07 17:41:57 · 370 阅读 · 0 评论 -
《算法分析与设计》Week 2
152. Maximum Product SubarrayDescription:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-原创 2017-03-05 20:29:26 · 394 阅读 · 0 评论 -
《算法分析与设计》Week 16
62. Unique PathsDescription:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point原创 2017-06-04 17:18:49 · 379 阅读 · 0 评论