- 博客(56)
- 收藏
- 关注
原创 724. Find Pivot Index
Given an array of integers nums, write a method that returns the "pivot" index of this array.We define the pivot index as the index where the sum of the numbers to the left of the index is equal to ...
2018-12-24 01:21:15
205
原创 674. Longest Continuous Increasing Subsequence
Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).Example 1:Input: [1,3,5,4,7]Output: 3Explanation: The longest continuous increasing ...
2018-12-23 23:30:51
252
原创 665. Non-decreasing Array
Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i] <= array[i + 1] holds for e...
2018-12-23 00:12:02
184
原创 643. Maximum Average Subarray I
Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the maximum average value.Example 1:Input: [1,12...
2018-12-21 00:09:05
185
原创 628. Maximum Product of Three Numbers
Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1:Input: [1,2,3]Output: 6 Example 2:Input: [1,2,3,4]Output: 24 Note:The...
2018-12-20 21:51:59
178
原创 605. Can Place Flowers
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die.Give...
2018-12-20 20:52:07
204
原创 581. Shortest Unsorted Continuous Subarray
Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.You need to find ...
2018-12-19 21:58:48
223
原创 532. K-diff Pairs in an Array
Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diffpair is defined as an integer pair (i, j), where i and j are both numbers in ...
2018-12-19 20:53:26
200
原创 414. Third Maximum Number
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, 1]...
2018-12-19 17:42:26
206
原创 268. Missing Number
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.Example 1:Input: [3,0,1]Output: 2Example 2:Input: [9,6,4,2,3,5,7,0,1]O...
2018-12-19 17:02:42
198
原创 661. Image Smoother
Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all the 8 surro...
2018-12-19 16:49:56
200
原创 697. Degree of an Array
Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.Your task is to find the smallest possible length...
2018-12-18 17:10:14
160
原创 717. 1-bit and 2-bit Characters
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).Now given a string represented by several bits....
2018-12-17 16:43:55
147
原创 448. Find All Numbers Disappeared in an Array
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.C...
2018-12-17 15:52:14
148
原创 283. Move Zeroes
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.Example:Input: [0,1,0,3,12]Output: [1,3,12,0,0]Note:You m...
2018-12-17 14:46:14
195
原创 485. Max Consecutive Ones
Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits are consecutive 1...
2018-12-17 14:05:48
228
原创 888. Fair Candy Swap
Alice and Bob have candy bars of different sizes: A[i] is the size of the i-th bar of candy that Alice has, and B[j] is the size of the j-th bar of candy that Bob has.Since they are friends, they wo...
2018-12-16 21:22:37
209
原创 896. Monotonic Array
An array is monotonic if it is either monotone increasing or monotone decreasing.An array A is monotone increasing if for all i <= j, A[i] <= A[j]. An array Ais monotone decreasing if for all...
2018-12-16 19:23:32
181
原创 566. Reshape the Matrix
In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.You're given a matrix represented by a two-dimen...
2018-12-16 19:08:13
165
原创 766. Toeplitz Matrix
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element.Now given an M x N matrix, return True if and only if the matrix is Toeplitz. Example 1:Input:matrix ...
2018-12-16 18:07:53
278
原创 867. Transpose Matrix
Given a matrix A, return the transpose of A.The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix. Example 1:Input: [[1,2...
2018-12-16 17:16:45
153
原创 922. Sort Array By Parity II
Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even.Sort the array so that whenever A[i] is odd, i is odd; and whenever A[i] is even, i is...
2018-12-16 16:15:22
147
原创 561.arrayPairSum
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as poss...
2018-12-14 20:38:04
234
原创 832.flipAndInvertImage
Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image.To flip an image horizontally means that each row of the image is reversed. For examp...
2018-12-14 19:33:56
220
原创 905.sortArrayByParity
Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.You may return any answer array that satisfies this conditi...
2018-12-14 16:33:49
165
原创 tensorboard显示loss
在mnist数据集中#添加节点tf.summary.scalar('loss', loss)#汇总记录节点merge = tf.summary.merge_all()#开启会话with tf.Session() as sess: sess.run(init) #文件保存位置 summary_writer = tf.summary.FileWrite...
2018-09-20 16:48:12
1902
原创 linux下clion配置opencv
安装好clion后,新建一个c++工程,在CmakeLists文件里添加:find_package(OpenCV REQUIRED)target_link_libraries(myproject ${OpenCV_LIBS})myproject是你项目的名字
2018-09-06 23:06:16
1309
原创 穷举数组中3个数
for (int i = 0; i < nums.size() - 2; i++) { for (int j = i+1; j < nums.size() - 1; j++) { for (int k = j+1; k < nums.size(); k++) { tempsum = nums[i] + nums[j] + nums[k...
2018-08-10 19:14:46
490
原创 vector<int> 和左值右值
1.赋值在编写c++程序的时候vector<int> a={0}; //错误的vector <int > a 赋值时需要赋予左值,左值也就是常量(或者说有地址的量,反之则是右值),左值在内存中具有实体,右值没有。正确的赋值方式应该是:int a[]={ 2, 7, 11, 15 };vector<int>arr(a, a + 4);...
2018-08-08 16:00:19
1022
原创 暗影精灵三 英伟达显卡 Ubuntu16.04 安装网卡驱动连接wifi
1、查看网卡型号$ uname -a2、我的电脑是RTL8111在官网http://www.realtek.com.tw/下载驱动,这是我的www.realtek.com.tw/downloads/downloadsView.aspx?Langid=3&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDow...
2018-04-10 19:53:02
3494
原创 python批量修改文件名称
# -*- coding: utf-8 -*- # 批量修改文件名称 author:penelope # import os import cv2 num=0 path = '/home/penelope/picture/desktop/' #需要修改的图像文件路径 path2=
2017-08-23 09:20:59
529
原创 linux qt c++11 编译
1.如果是使用Qt 5.x的版本,可以在 .pro文件里加这样一句话[cpp] view plain copyCONFIG += C++11 2.如果是 Qt 5.x之前的版本,可以使用这句话[cpp] view plain copyQMAKE_CXXFLAGS +
2017-07-10 15:05:01
814
原创 css盒模型
1.内边距 padding-top padding-right padding-bottom padding-left padding 如果使用百分数值指定内边距,百分数总是跟包含块的宽度有关,高度不考虑在内2.外边距 margin-top margin-botom margin-left
2017-03-20 07:31:44
352
原创 CSS边框和背景
1.border-width 取值是常规CSS长度,可以使用em,px,cm,百分数,thin,medium,thick2.border-style none 没边框 dashed 破折线边框 double 双线式边框 dotted 圆点线式边框 groove 槽线式边框 inset 使元
2017-03-20 07:14:57
361
原创 CSS选择器
1.属性选择器 基于属性的不同方面匹配属性 [href]{} [attr="val"] 选择attr属性,且属性值为val [attr^="val"] 选择attr属性,且属性值为val打头的元素 [attr$="val"] 选择attr属性,且属性值为val结尾的元素 [attr*="val"] 选择attr属性,且属性值为包含val的元素
2017-03-19 20:52:14
285
原创 HTML表单
1.form的action属性 action说明了提交表单时浏览器应该把从用户收集的数据发送到什么地方。2.mothod属性 设置表单发送数据到服务器方法。分为get和post方法。默认值为get方法3.enctype属性 指定了浏览器对发送给服务器的数据采集的编码方式,有三个值 application/x-www-form-urlencoded
2017-03-15 14:36:28
356
原创 HTML表格
1.thead元素 标记表格的标题行 thead{display:block; table-header-group:vertical:middle;border-color:inherit;}2、tbody元素 表示构成表格主体的全体行 tbody{display:block;table-roe-group:vertical-align:middle;bor
2017-03-15 13:13:22
384
原创 HTML文档分节
1、hground元素 用来将几个标题作为一个整体处理 hground{display:block;}2、section元素 可以明确的生成节并与其标题分开。section元素用来包含的是那种应该列入文档大纲或者目录中的内容。
2017-03-15 11:04:24
423
原创 HTML阻止内容
1.p元素 表示段落 p{display:block;margin-before:1em;margin-after:1em;margin-start:0;margin-end:0;}2、pre元素 改变浏览器处理内容的方式,阻止合并=空白字符,让源文件中的格式得以保存。 pre{dispaly:block;font-family:monospace;white
2017-03-15 10:45:52
468
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人