自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(139)
  • 收藏
  • 关注

原创 校招笔试——数字游戏

题目描述小易邀请你玩一个数字游戏,小易给你一系列的整数。你们俩使用这些整数玩游戏。每次小易会任意说一个数字出来,然后你需要从这一系列数字中选取一部分出来让它们的和等于小易所说的数字。 例如: 如果{2,1,2,7}是你有的一系列数,小易说的数字是11.你可以得到方案2+2+7 = 11.如果顽皮的小易想坑你,他说的数字是6,那么你没有办法拼凑出和为6 现在小易给你n个数,让你找出无法从n个数中...

2018-11-23 13:54:44 360

原创 校招笔试——优雅的点

题目描述小易有一个圆心在坐标原点的圆,小易知道圆的半径的平方。小易认为在圆上的点而且横纵坐标都是整数的点是优雅的,小易现在想寻找一个算法计算出优雅的点的个数,请你来帮帮他。例如:半径的平方如果为25优雅的点就有:(+/-3, +/-4), (+/-4, +/-3), (0, +/-5) (+/-5, 0),一共12个点。输入描述:输入为一个整数,即为圆半径的平方,范围在32位in...

2018-11-22 19:50:07 294

原创 校招笔试——解救小易

题目描述有一片1000*1000的草地,小易初始站在(1,1)(最左上角的位置)。小易在每一秒会横向或者纵向移动到相邻的草地上吃草(小易不会走出边界)。大反派超超想去捕捉可爱的小易,他手里有n个陷阱。第i个陷阱被安置在横坐标为xi ,纵坐标为yi 的位置上,小易一旦走入一个陷阱,将会被超超捕捉。你为了去解救小易,需要知道小易最少多少秒可能会走入一个陷阱,从而提前解救小易。输入描述:第...

2018-11-22 19:11:53 267

原创 校招编程——不要二

题目描述二货小易有一个W*H的网格盒子,网格的行编号为0~H-1,网格的列编号为0~W-1。每个格子至多可以放一块蛋糕,任意两块蛋糕的欧几里得距离不能等于2。对于两个格子坐标(x1,y1),(x2,y2)的欧几里得距离为:( (x1-x2) * (x1-x2) + (y1-y2) * (y1-y2) ) 的算术平方根小易想知道最多可以放多少块蛋糕在网格盒子里。输入描述:每组数组...

2018-11-21 16:30:04 251

原创 校招编程——合唱团

题目描述有 n 个学生站成一排,每个学生有一个能力值,牛牛想从这 n 个学生中按照顺序选取 k 名学生,要求相邻两个学生的位置编号的差不超过 d,使得这 k 个学生的能力值的乘积最大,你能返回最大的乘积吗?输入描述:每个输入包含 1 个测试用例。每个测试数据的第一行包含一个整数 n (1 <= n <= 50),表示学生的个数,接下来的一行,包含 n 个整数,按顺序表示每...

2018-11-20 22:59:53 181

原创 opencv 常用函数(c++)

1.创建滑动条int creatTrackbar(conststring& trackbarname, conststrint& winname, int* value, int count, TrackbarCallback onChange=0, void* userdata=0);含义:trackbarname 为轨迹条名,winname 为窗口名,valu...

2018-11-16 16:06:00 1324

原创 网易2018实习生招聘笔试题-C++开发实习生算法题

[编程题] 被3整除时间限制:1秒空间限制:32768K小Q得到一个神奇的数列: 1, 12, 123,...12345678910,1234567891011...。并且小Q对于能否被3整除这个性质很感兴趣。小Q现在希望你能帮他计算一下从数列的第l个到第r个(包含端点)有多少个数可以被3整除。输入描述:输入包括两个整数l和r(1 <= l <= r <= ...

2018-10-31 19:36:16 527

原创 leetcode 141 Linked List Cycle

python:class Solution(object): def hasCycle(self, head): """ :type head: ListNode :rtype: bool """ if not head: return False ...

2018-10-29 11:05:28 150

原创 leetcode 155 Min Stack

python:class MinStack: def __init__(self): """ initialize your data structure here. """ self.stack = [] def push(self, x): """ :ty...

2018-10-25 09:39:17 189

原创 leetcode 637 Average of Levels in Binary Tree

python:class Solution: def averageOfLevels(self, root): """ :type root: TreeNode :rtype: List[float] """ if root is None: return [] r...

2018-10-24 11:10:35 177

原创 819 Most Common Word

python;class Solution: def mostCommonWord(self, paragraph, banned): """ :type paragraph: str :type banned: List[str] :rtype: str """ res = ('', -...

2018-10-23 16:49:32 249

原创 733 Flood Fill

python:class Solution: def floodFill(self, image, sr, sc, newColor): """ :type image: List[List[int]] :type sr: int :type sc: int :type newColor: int ...

2018-10-17 16:52:43 249

原创 vs 2017 配置 openCV 3.4.3

1. 从官网https://www.opencv.org/releases.html下载 windows版 opencv3.4.3 并安装 ,这个过程很简单。2. 在系统环境变量Path中添加如下环境变量。3. 打开 vs2017 新建一个空项目,然后Ctrl+Shift+a添加一个c++文件。4. 进入视图→其他窗口→属性管理器,打开Debug|x64,选择添加新项目属性...

2018-10-09 15:59:18 1724

原创 leetcode 257 Binary Tree Paths

python:class Solution(object): def binaryTreePaths(self, root): """ :type root: TreeNode :rtype: List[str] """ path = '' res = [] self.Tr...

2018-10-08 10:08:15 164

原创 leetcode 739 Daily Temperatures

python:class Solution: def dailyTemperatures(self, temperatures): """ :type temperatures: List[int] :rtype: List[int] """ stack = [[temperatures[0], 0]]...

2018-10-07 21:37:00 183

原创 leetcode 872 Leaf-Similar Trees

python:class Solution: def leafSimilar(self, root1, root2): """ :type root1: TreeNode :type root2: TreeNode :rtype: bool """ def leaf(root): ...

2018-09-28 09:52:59 148

原创 leetcode 202 Happy Number

python:class Solution: def isHappy(self, n): """ :type n: int :rtype: bool """ check = [n] while (n != 1): t = 0 for j in...

2018-09-27 10:47:36 120

原创 leetcode 645 Set Mismatch

python:class Solution: def findErrorNums(self, nums): """ :type nums: List[int] :rtype: List[int] """ l = len(nums) res = [] res.append(s...

2018-09-13 15:09:11 292

原创 TensorFlow(六)——MNIST分类之自动编码器

import input_dataimport tensorflow as tfimport numpy as npimport matplotlib.pyplot as pltmnist = input_data.read_data_sets('data/', one_hot=True)#设置训练超参learning_rate = 0.01training_epochs = ...

2018-09-13 10:34:08 797

原创 TensorFlow(五)——MNIST分类值RNN

import input_dataimport tensorflow as tfimport numpy as npmnist = input_data.read_data_sets('data/', one_hot=True)#设置训练超参数lr = 0.001training_iters = 100000batch_size = 128#设置神经网络参数n_input...

2018-09-12 22:20:32 231

原创 leetcode 859 Buddy Strings

python:class Solution: def buddyStrings(self, A, B): """ :type A: str :type B: str :rtype: bool """ if A == B: return len(set(A)) !=...

2018-09-12 15:41:16 174

原创 TensorFlow(四)——MNIST分类之CNN

import input_dataimport tensorflow as tfimport numpy as npmnist = input_data.read_data_sets('data/', one_hot=True)trX, trY, teX, teY = mnist.train.images, mnist.train.labels, mnist.test.images,...

2018-09-12 14:21:00 248

原创 TensorFlow(三)——MNIST分类

import input_dataimport tensorflow as tfmnist = input_data.read_data_sets('data/', one_hot=True)#定义回归模型x = tf.placeholder(tf.float32, [None, 784])w = tf.Variable(tf.zeros([784, 10]))b = tf.Va...

2018-09-11 21:51:04 262

原创 leetcode 804 Unique Morse Code Words

python:class Solution: def uniqueMorseRepresentations(self, words): """ :type words: List[str] :rtype: int """ m = [".-","-...","-.-.","-..&quot

2018-09-11 16:41:09 189

原创 TensorFlow(二)——第一个程序

import tensorflow as tfimport numpy as npx_data = np.linspace(-1,1,300)[:, np.newaxis]#np.linspace 返回等差数列#np.newaxis == Nonenoise = np.random.normal(0, 0.05, x_data.shape)#加入噪点y_data = np.squ...

2018-09-11 16:09:31 190

原创 leetcode 118 Pascal's Triangle

python:class Solution: def generate(self, numRows): """ :type numRows: int :rtype: List[List[int]] """ res = [] arr = [1]*numRows ...

2018-09-10 16:52:25 131

原创 TensorFlow(一)——conda版安装

1.安装anaconda:从https://repo.continuum.io/archive/index.html选择相应版本,我选择的是最新的版本5.2.0:wget https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh之后直接进行安装:bash Anaconda3-5.2.0-Linux-x86...

2018-09-07 20:45:23 319

原创 leetcode 88 Merge Sorted Array

python:class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :...

2018-09-07 19:02:18 134

原创 leetcode 69 Sqrt(x)

python:class Solution: def mySqrt(self, x): """ :type x: int :rtype: int """ left = 0 right = x while (left <= right): mid...

2018-09-03 14:52:14 133

原创 leetcode 543 Diameter of Binary Tree

python:class Solution: def diameterOfBinaryTree(self, root): """ :type root: TreeNode :rtype: int """ if not root: return 0 self.long...

2018-07-17 21:26:05 132

原创 leetcode 860 Lemonade Change

python:class Solution: def lemonadeChange(self, bills): """ :type bills: List[int] :rtype: bool """ mon = dict() mon[5] = 0 mon[10] = 0 ...

2018-07-16 19:31:57 198

原创 leetcode 387 First Unique Character in a String

python:class Solution: def firstUniqChar(self, s): """ :type s: str :rtype: int """ l = dict() for i in list(s): if i in l: ...

2018-07-13 14:49:17 153

原创 leetcode 74 Search a 2D Matrix

python:class Solution: def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ if len(matrix) =...

2018-07-12 15:27:43 180

原创 leetcode 66 Plus One

python:class Solution: def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ res = [] t = 1 for i in digits[::-1]: ...

2018-07-05 11:04:19 158

原创 leetcode 35 Search Insert Position

python:class Solution: def searchInsert(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ t = 0 for index, i ...

2018-07-04 16:35:42 141

原创 leetcode 485 Max Consecutive Ones

python:class Solution: def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ res = 0 l = 0 for i in nums: ...

2018-07-02 17:17:57 186

原创 leetcode 283 Move Zeroes

python:class Solution: def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ i = 0 ...

2018-06-29 11:06:58 115

原创 leetcode 93 Restore IP Addresses

python:class Solution: def restoreIpAddresses(self, s): """ :type s: str :rtype: List[str] """ def dfs(s, index, path, res): if index == 4: ...

2018-06-25 11:18:15 145

原创 leetcode 232 Implement Queue using Stacks

python:class MyQueue: def __init__(self): """ Initialize your data structure here. """ self.s1 = [] self.s2 = [] def push(self, x): """ ...

2018-06-22 12:41:16 148

原创 leetcode 189 Rotate Array

c++:class Solution {public: void rotate(vector<int>& nums, int k) { k = k % nums.size(); reverse(nums.begin(), nums.end()); reverse(nums.begin(), nums.begin() + ...

2018-06-20 17:20:16 101

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除