- 博客(21)
- 收藏
- 关注
原创 刷题总结#17
#48. Rotate Image You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise)./* * clockwise rotate * first reverse up to down, then swap the symmetry * 1 2
2017-05-08 21:52:21
201
原创 刷题总结#16
#334. Increasing Triplet Subsequence Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the function should: Return true if there exists
2017-04-26 14:23:20
206
原创 刷题总结#15
#380 Insert Delete GetRandom O(1) 1.Design a data structure that supports all following operations in average O(1) time.insert(val): Inserts an item val to the set if not already present. remove(val)
2017-04-25 11:23:06
218
原创 刷题总结#13
#390. Elimination Game There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afterward until you reach the end of the list.Repeat
2017-04-16 20:40:50
203
原创 刷题总结#12
#424. Longest Repeating Character Replacement 好巧妙的一道题! Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times.
2017-04-12 14:30:28
155
原创 刷题总结#11
#398. Random Pick Index Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.O(n
2017-04-10 23:11:28
147
原创 linux学习#2
TypeError: ufunc ‘subtract’ did not contain a loop with signature matching types dtype(‘
2017-04-09 17:35:18
192
原创 深度学习python
#squeeze 降维 维度为1的降掉 tf.squeeze(arr, []) 降维, 将维度为1 的降掉 arr = tf.Variable(tf.truncated_normal([3,4,1,6,1], stddev=0.1)) arr2 = tf.squeeze(arr, [2,4]) arr3 = tf.squeeze(arr) #降掉所以是1的维#split tf.split
2017-04-09 13:22:39
325
原创 刷题总结#11
#319. Bulb Switcher There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’
2017-04-09 00:00:14
245
原创 linux学习
1.查看图片的属性 首先需要安装:imagemagick,即: # apt-get install imagemagick用 identify 命令查询对应图片的信息,即: # identify logo.jpg
2017-04-08 23:29:00
151
原创 刷题总结#10
这道题其实挺简单的,如果把警察的监视范围当作一个pair < int,int>来排序比较的话,时间是超的。 那么我们把监视范围的left,right。在一个nums的数组中表示。 nums[left]+1,nums[right+1]-1; cnt记录此时nums数组的和。 如果有值,表示监视。 #include #include #include #include #in
2017-04-07 21:25:57
178
原创 刷题总结#9
#241. Different Ways to Add Parentheses Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid
2017-04-07 17:53:09
268
原创 刷题总结#8
#287. Find the Duplicate Number Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there
2017-04-06 23:41:37
160
原创 刷题总结#7
#452. Minimum Number of Arrows to Burst Balloons There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the hor
2017-04-05 23:03:02
194
原创 刷题总结#6
#378. 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 k
2017-04-05 11:41:51
242
原创 #刷题总结5
#486. Predict the Winner Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on.
2017-04-04 17:34:36
170
原创 刷题总结#4
#421 Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231.Find the maximum result of ai XOR aj, where 0 ≤ i, j < n. Input: [3, 10, 5, 25, 2, 8]Output: 28Explanation: The maxi
2017-04-04 02:11:56
293
原创 刷题总结#3
# 382 一个listnode列表,等可能地获得一个数,通过遍历实现 假设有n个,每个概率为1/n,但是遍历的时候遍历到k(k < n),第k个概率为1/k,【不选中k后一个的概率为k/n】,所以最后算选到k的概率还是1/n。 int getRandom() { int res = head->val; ListNode* node
2017-04-03 18:55:54
153
原创 刷题总结#2
1.从一句话中读取每一个单词 eg: i have an apple and i have a pen string s=这句话; string ans; istringstream is(s); while(is>>tmp) { ans=tmp; }
2017-04-03 10:25:24
201
原创 linux系统(ubuntu14.04)误更新显卡驱动,导致AMAX机器崩溃
出现了进不去系统,initialize failed.的情况。 开机不停按F8,回到上一次正确的配置,依然出现上述情况。 经过排查,觉得是升级了显卡驱动导致的,所以重新下载了一个合适的驱动:http://cn.download.nvidia.com/XFree86/Linux-x86_64/378.09/NVIDIA-Linux-x86_64-378.09.run 安装在/home下 【如
2017-03-28 16:44:14
2010
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人