随笔分类 -  Leetcode

1 2 3 4 5 ··· 9 下一页
摘要:我们有两个长度相等且不为空的整型数组 A 和 B 。 我们可以交换 A[i] 和 B[i] 的元素。注意这两个元素在各自的序列中应该处于相同的位置。 在交换过一些元素之后,数组 A 和 B 都应该是严格递增的(数组严格递增的条件仅为A[0] < A[1] < A[2] < … < A[A.lengt 阅读全文
posted @ 2020-01-28 00:19 Jessica程序猿 阅读(677) 评论(0) 推荐(1)
摘要:You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality c... 阅读全文
posted @ 2015-09-20 17:05 Jessica程序猿 阅读(316) 评论(0) 推荐(0)
摘要:Perfect SquaresGiven a positive integern, find the least number of perfect square numbers (for example,1, 4, 9, 16, ...) which sum ton.For example, gi... 阅读全文
posted @ 2015-09-20 16:42 Jessica程序猿 阅读(231) 评论(0) 推荐(0)
摘要:Given a range [m, n] where 0 >1; n=n>>1; ++count; } return m<<count; }}; 阅读全文
posted @ 2015-04-30 15:33 Jessica程序猿 阅读(179) 评论(0) 推荐(0)
摘要:Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3 --... 阅读全文
posted @ 2015-04-30 15:30 Jessica程序猿 阅读(186) 评论(0) 推荐(0)
摘要:题目描述:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive in... 阅读全文
posted @ 2015-04-30 15:19 Jessica程序猿 阅读(410) 评论(0) 推荐(0)
摘要:Description:Count the number of prime numbers less than a non-negative number,nHint:The number n could be in the order of 100,000 to 5,000,000.C++实现代码... 阅读全文
posted @ 2015-04-27 20:36 Jessica程序猿 阅读(207) 评论(0) 推荐(0)
摘要:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo... 阅读全文
posted @ 2015-04-04 23:07 Jessica程序猿 阅读(212) 评论(0) 推荐(0)
摘要:好久没有刷leetcode了,要继续了。。今天第一题。Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered fr... 阅读全文
posted @ 2015-04-04 22:28 Jessica程序猿 阅读(385) 评论(0) 推荐(0)
摘要:Given a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, 5, 9], the largest formed num... 阅读全文
posted @ 2015-01-19 08:59 Jessica程序猿 阅读(412) 评论(0) 推荐(0)
摘要:The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a... 阅读全文
posted @ 2015-01-09 13:23 Jessica程序猿 阅读(381) 评论(0) 推荐(0)
摘要:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the next... 阅读全文
posted @ 2015-01-03 10:33 Jessica程序猿 阅读(190) 评论(0) 推荐(0)
摘要:Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.类似于cc:http://www.cnblogs.com/... 阅读全文
posted @ 2014-12-31 08:31 Jessica程序猿 阅读(175) 评论(0) 推荐(0)
摘要:Related to questionExcel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A ... 阅读全文
posted @ 2014-12-29 09:10 Jessica程序猿 阅读(192) 评论(0) 推荐(0)
摘要:Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the arr... 阅读全文
posted @ 2014-12-23 11:12 Jessica程序猿 阅读(208) 评论(0) 推荐(0)
摘要:Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 ->... 阅读全文
posted @ 2014-12-23 10:54 Jessica程序猿 阅读(215) 评论(0) 推荐(0)
摘要:Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating,... 阅读全文
posted @ 2014-12-18 22:57 Jessica程序猿 阅读(324) 评论(0) 推荐(0)
摘要:Compare two version numbersversion1andversion1.Ifversion1>version2return 1, ifversion1#include#include#include#includeusing namespace std;class Soluti... 阅读全文
posted @ 2014-12-18 20:43 Jessica程序猿 阅读(316) 评论(0) 推荐(0)
摘要:Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ... 阅读全文
posted @ 2014-12-17 22:59 Jessica程序猿 阅读(261) 评论(0) 推荐(0)
摘要:A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its index.... 阅读全文
posted @ 2014-12-08 17:25 Jessica程序猿 阅读(373) 评论(0) 推荐(0)

1 2 3 4 5 ··· 9 下一页