- 博客(24)
- 资源 (1)
- 收藏
- 关注
原创 LeetCode: Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 intonums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal tom + n) to hold addit
2016-08-31 00:17:51 230
原创 LeetCode: Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.源代码:/** * Definition for singly-linked list. *
2016-08-31 00:08:03 160
原创 LeetCode: Reverse Linked List
Reverse a singly linked list.源代码1:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */c
2016-08-30 13:55:23 152
原创 LeetCode: Wiggle Sort II
Given an unsorted array nums, reorder it such that nums[0] nums[2] .Example:(1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is [1, 4, 1, 5, 1, 6]. (2) Given nums = [1, 3, 2, 2, 3
2016-08-26 18:05:59 336
原创 LeetCode: Kth Largest Element in an Array
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5.
2016-08-26 17:54:31 332
原创 LeetCode: Top K Frequent Elements
Given a non-empty array of integers, return the k most frequent elements.For example,Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume k is always valid, 1 ≤ k ≤ number
2016-08-26 09:31:56 203
转载 Qt: QObject::connect: Cannot queue arguments of type 'XXX'
1 开发环境 Win10(64bit) Qt5.4.2(64bit)2 错误描述 在不同线程之间通过信号/槽来传递自定义数据类型QList的时候,提示错误:[plain] view plain copy QObject::connect: Cannot queue arguments of type 'QList' (Make s
2016-08-25 14:27:11 5018
原创 LeetCode: Find K Pairs with Smallest Sums
You are given two integer arrays nums1 and nums2 sorted in ascending order and an integerk. Define a pair (u,v) which consists of one element from the first array and one element from the second a
2016-08-25 10:13:43 212
原创 LeetCode: First Unique Character in a String
Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetcode",return 2.Note
2016-08-23 21:24:22 242
原创 LeetCode: Set Matrix Zeroes
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution using O(m
2016-08-23 18:27:31 144
原创 LeetCode: First Missing Positive
Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n) time and uses constant
2016-08-22 23:12:19 198
原创 LeetCode: Majority Element II
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.题目解析:根据题目描述,我们知道一个数组中最多两个满足要求的结果。因此,这里可以用投票法,
2016-08-21 18:03:07 166
原创 LeetCode: Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element
2016-08-21 17:00:20 173
原创 LeetCode: Excel Sheet Column Number
Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28F
2016-08-21 16:49:50 184
原创 LeetCode:Kth Smallest Element in a Sorted Matrix
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 the kth smallest element in the sorted order, not
2016-08-20 17:23:01 222
原创 LeetCode: Coin Change
You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money
2016-08-17 19:28:36 140
原创 LeetCode: Ransom Note
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constru
2016-08-17 18:06:04 277
原创 opencv Mat 与 Qt QImage之间的转换
opencv Mat 与 Qt QImage 之间的转换,下面是两个例子,其他可相似处理QImage Mat2QImage(const cv::Mat3b &src) { QImage dest(src.cols, src.rows, QImage::Format_ARGB32); for (int y = 0; y < src.rows; ++y) {
2016-08-16 15:07:36 338
转载 【《代码整洁之道》精读与演绎】之三 整洁代码的函数书写准则
原文地址:http://blog.csdn.net/poem_qianmo/article/details/52204224这篇文章,是关于整洁代码函数书写的一些准则。 一、引言以下引言的内容,有必要伴随这个系列的每一次更新,这次也不例外。 《代码整洁之道》这本书提出了一个观点:代码质量
2016-08-15 10:03:56 557
转载 【《代码整洁之道》精读与演绎】之二 高质量代码的命名法则
原文地址: http://blog.csdn.net/poem_qianmo/article/details/52144086一、引言 《代码整洁之道》这本书提出了一个观点:代码质量与其整洁度成正比,干净的代码,既在质量上可靠,也为后期维护、升级奠定了良好基础。书中介绍的规则均来自作者多年的实践经验,涵盖从命名到重构的多个编程方面,虽为一“家
2016-08-15 10:02:05 272
转载 【《代码整洁之道》精读与演绎】之一 让代码比你来时更干净http://blog.csdn.net/poem_qianmo/article/details/52079996
原文地址:http://blog.csdn.net/poem_qianmo/article/details/52079996“我们就是一群代码猴子,上蹿下跳,自以为领略了编程的真谛。可惜当我们抓着几个酸桃子,得意洋洋坐到树枝上,却对自己造成的混乱熟视无睹。那堆“可以运行”的乱麻程序,就在我们的眼皮底下慢慢腐坏。”——《代码整洁之道》作者 RobertC.Ma
2016-08-15 09:58:48 483
原创 LeetCode: Integer Break
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-08-11 17:32:38 165
原创 LeetCode: Count Numbers with Unique Digits
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x n.Example:Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x [11,22,33,4
2016-08-11 16:44:47 165
原创 LeetCode: Intersection of Two Arrays II
Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note:Each element in the result should appear as ma
2016-08-10 23:50:05 142
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人