摘要: Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10^n. Example:Given n = 2, return 91. (The answer should be the 阅读全文
posted @ 2016-08-19 12:51 fenshen371 阅读(159) 评论(0) 推荐(0) 编辑
摘要: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following matrix: You s 阅读全文
posted @ 2016-08-19 12:27 fenshen371 阅读(130) 评论(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 @ 2016-08-19 11:38 fenshen371 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is th 阅读全文
posted @ 2016-08-19 08:33 fenshen371 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to find the number of connected 阅读全文
posted @ 2016-08-19 07:11 fenshen371 阅读(151) 评论(0) 推荐(0) 编辑