- 博客(14)
- 收藏
- 关注
原创 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 167
原创 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 135
原创 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 312
原创 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 823
原创 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 251
原创 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 195
原创 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 269
原创 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 284
原创 leetcode 804 Unique Morse Code Words
python:class Solution: def uniqueMorseRepresentations(self, words): """ :type words: List[str] :rtype: int """ m = [".-","-...","-.-.","-.."
2018-09-11 16:41:09 209
原创 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 211
原创 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 165
原创 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 350
原创 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 155
原创 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 175
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人