题意是不用加减法做到对两个整数求和。这里我参考了grandyang大神的思路,就不过多解释了,https://www.cnblogs.com/grandyang/p/5631814.html 时间O(1) 空间O(1) ...
分类:
其他好文 时间:
2019-10-17 23:46:17
阅读次数:
98
一 图像阈值处理 准备一张灰度图像 阈值处理通常是设定一个阈值,让图片的所有像素点的值与其比较做出一系列的操作。 在opencv常用的阈值处理函数有五种,分别是THRESH_BINARY、THRESH_BINARY_INV、THRESH_TRUNC、THRESH_TOZERO、THRESH_TOZE ...
分类:
其他好文 时间:
2019-10-17 23:22:37
阅读次数:
152
颜色排序,中文又叫做荷兰国旗。好吧,题意是给一个数组,里面只有0,1,2三个数字,把数组排序成[0, 0, 0, 1, 1, 1, ....1, 2, 2, 2, 2, 2]的样子。 思路是two pointer夹逼扫描,遇到0就放在左起当前的位置,遇到1就不处理,遇到2就放在右起当前位置。代码如下 ...
分类:
其他好文 时间:
2019-10-17 01:23:08
阅读次数:
85
Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endp ...
分类:
其他好文 时间:
2019-10-16 21:41:10
阅读次数:
75
题面 Given two integers $n$ and $x$, construct an array that satisfies the following conditions: ·for any element ai in the array, $1≤ai const int maxn ...
分类:
其他好文 时间:
2019-10-15 20:50:19
阅读次数:
69
fsaf 167. Two Sum II - Input array is sorted Easy 167. Two Sum II - Input array is sorted Easy Easy Given an array of integers that is already sorted ...
分类:
其他好文 时间:
2019-10-15 13:00:51
阅读次数:
87
Given a string s , find the length of the longest substring t that contains at most 2 distinct characters. Example 1: Example 2: ...
分类:
其他好文 时间:
2019-10-15 10:15:53
阅读次数:
83
Basic navigation by using 'Navigator.push' & 'Navigator.pop()', for example, we have two screen, screen1 and screen2, we want to navigate between two ...
分类:
其他好文 时间:
2019-10-13 21:05:55
阅读次数:
142
这题思路跟2很相似。唯一的不同点在于,2只是正向做加法,但是445是在逆向做加法。这题我的思路是先用stack存住两个list的nodes,然后pop出来的时候做加法。这样就不需要操心reverse linked list这件事了。 ...
分类:
其他好文 时间:
2019-10-13 15:07:06
阅读次数:
97
D - Various Sushi Time Limit: 2 sec / Memory Limit: 1024 MB Score : 400400 points Problem Statement There are NN pieces of sushi. Each piece has two p ...
分类:
其他好文 时间:
2019-10-13 13:05:38
阅读次数:
85