
数学
文章平均质量分 69
sscssz
这个作者很懒,什么都没留下…
展开
-
304. Range Sum Query 2D - Immutable 【M】【27】
Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2). The above rectangle (with the red bord原创 2016-05-28 13:26:54 · 426 阅读 · 0 评论 -
【leetcode】462. Minimum Moves to Equal Array Elements II【M】
Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected element by原创 2016-11-21 14:03:14 · 784 阅读 · 0 评论 -
【leetcode】463. Island Perimeter【E】
You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely原创 2016-11-21 13:06:13 · 1332 阅读 · 0 评论 -
413. Arithmetic Slices 【M】
A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. For example, these are arithmetic seque原创 2016-11-13 22:05:40 · 388 阅读 · 0 评论 -
【leetcode】414. Third Maximum Number【E】【85】
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). Example 1: Input: [3, 2,原创 2016-10-29 15:11:52 · 558 阅读 · 0 评论 -
405. Convert a Number to Hexadecimal【E】【leetcode】
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: All letters in hexadecimal (a-f) must be in lowercase.The hexade原创 2016-11-09 15:11:51 · 398 阅读 · 0 评论 -
【leetcode】423. Reconstruct Original Digits from English【M】【95】
Given a non-empty string containing an out-of-order English representation of digits 0-9, output the digits in ascending order. Note: Input contains only lowercase English letters.Input is g原创 2016-10-28 14:29:41 · 510 阅读 · 0 评论 -
【leetcode】453. Minimum Moves to Equal Array Elements【E】
Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 elements by 1. Example: Input: [1,2,3] Ou原创 2016-11-07 16:09:34 · 898 阅读 · 0 评论 -
【leetcode】441. Arranging Coins【E】
You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total number of full staircase rows that can be formed.原创 2016-11-02 21:46:38 · 447 阅读 · 0 评论 -
【Leetcode】397. Integer Replacement QuestionEditorial Solution【E】
Given a positive integer n and you can do operations as follow: If n is even, replace n with n/2.If n is odd, you can replace n with either n + 1 or n - 1. What is the minimum number o原创 2016-09-13 10:16:32 · 598 阅读 · 0 评论 -
【leetcode】367. Valid Perfect Square【M】【35】
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 library function such as sqrt. Example 1: Input: 16 Returns: T原创 2016-07-05 15:00:50 · 696 阅读 · 0 评论 -
233. Number of Digit One【H】【33】【再来一遍】
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. For example: Given n = 13, Return 6, because digit 1 occurred in the followin原创 2016-05-21 16:46:28 · 521 阅读 · 0 评论 -
168. Excel Sheet Column Title 【E】【66】【leetcode】
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB Credit原创 2016-04-24 15:20:27 · 404 阅读 · 0 评论 -
50. Pow(x, n) 【M】【62】
Implement pow(x, n). Subscribe to see which companies asked this question 最开始肯定是用x ** n,当然这个太无赖。 开始自己实现,首先想的是,每次平方,但是遇到2^k - 1这种,就等于没有量级上的优化,肯定是超时了。 提示是二分法,那就增加一个字典,来存这原创 2016-04-24 14:45:12 · 869 阅读 · 0 评论 -
343. Integer Break 【M】
Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get. For example, given n = 2, ret原创 2016-04-23 17:16:57 · 428 阅读 · 0 评论 -
43. Multiply Strings 【66】【M】
Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-negative.Converting the input string to integ原创 2016-05-18 20:25:50 · 529 阅读 · 0 评论 -
【LeetCode】492. Construct the Rectangle【E】【73】
For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L原创 2017-02-23 16:23:15 · 588 阅读 · 0 评论