上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 16 下一页
摘要: 题面 给定两个有序整数数组 nums1 和 nums2,将 nums2 合并到 nums1 中,使得 num1 成为一个有序数组。 样例 算法 时间复杂度:O(n+m) 与合并有序链表类似。 1. 如果m为0,直接返回就可以了。如果n为0,则需要把nums2中前n个元素都搬到nums1中,返回。 2 阅读全文
posted @ 2019-05-21 18:26 yocichen 阅读(327) 评论(0) 推荐(0)
摘要: 题面 合并两个排序链表。 算法 创建结果链表头*res,*p指向头,当两个链表节点都不为空时,比较节点值,值小的挂在p后面,二者(p和小者)顺次后移。知道某条链表空,跳出while循环。接着,直接将不空的链表挂在p后即可。 Note: 注意返回值 res->next; 源码 阅读全文
posted @ 2019-05-21 17:30 yocichen 阅读(181) 评论(0) 推荐(0)
摘要: 题面 原题挺长的,还是英文,就不抄了,😄。 给定字符串,可能由若干个空格开头,之后可能会跟一串数组,数字可能由-/+开头,之后会跟有若干其他字母,找出并计算该数字并返回。 Note: 超出INT_MAX 和 INT_MIN 返回它俩。(所以考虑用更大类型来暂存中间结果。) 样例 Example 1 阅读全文
posted @ 2019-05-20 23:07 yocichen 阅读(215) 评论(0) 推荐(0)
摘要: 题面 A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at an 阅读全文
posted @ 2019-05-19 18:04 yocichen 阅读(245) 评论(0) 推荐(0)
摘要: 题面 A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at an 阅读全文
posted @ 2019-05-19 16:06 yocichen 阅读(245) 评论(0) 推荐(0)
摘要: 题面 Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its pat 阅读全文
posted @ 2019-05-19 00:00 yocichen 阅读(217) 评论(0) 推荐(0)
摘要: 在项目 *.pro中添加即可。 阅读全文
posted @ 2019-05-18 20:23 yocichen 阅读(1381) 评论(0) 推荐(0)
摘要: 题面 给定x, n, 求pow(x, n)。 样例 Example 1: Example 2: Example 3: Note: -100.0 < x < 100.0 n is a 32-bit signed integer, within the range [−231, 231 − 1] 要小心 阅读全文
posted @ 2019-05-17 10:27 yocichen 阅读(184) 评论(0) 推荐(0)
摘要: 题面 Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes, only nodes itself may be 阅读全文
posted @ 2019-05-16 21:42 yocichen 阅读(245) 评论(0) 推荐(0)
摘要: 题面 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses 给定int n,代表n组括号,编码生成所有有效的括号组合(即符合括号嵌套规则) 样例 g 阅读全文
posted @ 2019-05-16 11:58 yocichen 阅读(227) 评论(0) 推荐(0)
摘要: 图象腐蚀与形态学操作 opencv 1. 通过调用库函数实现图像的腐蚀、膨胀; 2. 通过设置结构元素、元素大小、形态学操作类型实现对图象的形态学操作。 源码(VS2017+OpenCV 4.0) 效果图 1. 图像腐蚀、膨胀 2. 形态学操作 其他组合操作,自己去探索吧,挺有趣的! 更多openc 阅读全文
posted @ 2019-05-15 16:45 yocichen 阅读(486) 评论(2) 推荐(0)
摘要: OpenCV 使用 createtrackerbar()报错问题 Error Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow, file c:\build\master_winpack-build-win64 阅读全文
posted @ 2019-05-15 15:22 yocichen 阅读(700) 评论(0) 推荐(0)
摘要: 题面 Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the 阅读全文
posted @ 2019-05-14 16:06 yocichen 阅读(142) 评论(0) 推荐(0)
摘要: 题面 Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to 阅读全文
posted @ 2019-05-14 15:13 yocichen 阅读(193) 评论(0) 推荐(0)
摘要: 题面 Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b+ c + d = target? Find all unique 阅读全文
posted @ 2019-05-13 21:52 yocichen 阅读(183) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 16 下一页