摘要: 2017/3/30 13:01:59 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 foll 阅读全文
posted @ 2017-03-30 14:32 会飞的胖子 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 解法1:朴素算法 矩阵乘法公式 θ(n3) public static int[][] SparseMatrixMultiplication( int[][] A , int[][] B ){ int M = A.length; int N = B[0].length;//取列长 int K = A 阅读全文
posted @ 2017-03-27 22:04 会飞的胖子 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 2017/3/23 17:52:07 Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the arr 阅读全文
posted @ 2017-03-27 00:00 会飞的胖子 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 2017/3/23 22:23:57 Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given 阅读全文
posted @ 2017-03-26 23:59 会飞的胖子 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 2017/3/23 15:41:47 Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. N 阅读全文
posted @ 2017-03-26 23:59 会飞的胖子 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 2017/3/16 22:36:02 Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, t 阅读全文
posted @ 2017-03-26 23:58 会飞的胖子 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 2017/3/14 15:23:55 The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integ 阅读全文
posted @ 2017-03-26 23:58 会飞的胖子 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 2017/3/16 20:03:07 Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example:Given a = 1 and b = 2, retu 阅读全文
posted @ 2017-03-26 23:57 会飞的胖子 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 2017/3/15 21:47:04 Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a 阅读全文
posted @ 2017-03-26 23:57 会飞的胖子 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 2017/3/14 15:36:44 Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. N 阅读全文
posted @ 2017-03-26 23:57 会飞的胖子 阅读(121) 评论(0) 推荐(0) 编辑