6 轩辕袭智

尚未进行身份认证

我要认证

暂无相关简介

等级
TA的排名 28w+

学习笔记(1):视觉应用--机器学习&深度学习基础-线性回归的Keras实现03-损失函数、梯度下降和评价指标...

本课程为视觉应用工程师的基础课程,主要补充OpenCV图像处理入门基础,机器学习基础,和深度学习基础。

2020-08-08 06:53:21

997. 找到小镇的法官

class Solution: def findJudge(self, N: int, trust: List[List[int]]) -> int: l1 = [] l2 = [] for i in range(len(trust)): l1.append(trust[i][0]) l2.append(trust[i][1]) for i in range(1, N+1):

2020-08-04 20:34:58

875. 爱吃香蕉的珂珂

class Solution: def minEatingSpeed(self, piles: List[int], H: int) -> int: left = 1 right = max(piles) while left < right: mid = (left + right) // 2 if self.__calculate_sum(piles, mid) > H: .

2020-08-04 20:31:17

33. 搜索旋转排序数组

class Solution: def search(self, nums: List[int], target: int) -> int: self.idx = -1 self.divide(nums, target, 0, len(nums) - 1) return self.idx def divide(self, nums, target, left, right): if left > right

2020-08-04 20:29:42

34. 在排序数组中查找元素的第一个和最后一个位置

class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: self.max = -inf self.min = inf self.divide(nums, target, 0, len(nums) - 1) if self.max == -inf or self.max == inf: self.max

2020-08-04 20:29:10

199. 二叉树的右视图

# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution: def rightSideView(self, root: TreeNode) -> List[int]: res = []

2020-08-04 20:28:37

114. 二叉树展开为链表

# Definition for a binary tree node.# class TreeNode:# def __init__(self, val=0, left=None, right=None):# self.val = val# self.left = left# self.right = rightclass Solution: def flatten(self, root: TreeNode) -> None

2020-08-04 20:28:03

35. 搜索插入位置

class Solution: def searchInsert(self, nums: List[int], target: int) -> int: self.idx = 0 self.divide(nums, target, 0, len(nums) - 1) return self.idx def divide(self, nums, target, left, right): if left &gt

2020-08-04 20:26:52

236. 二叉树的最近公共祖先

# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeN

2020-08-04 20:25:17

113. 路径总和 II

# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution: def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]:

2020-08-04 20:24:12

22. 括号生成

class Solution: def generateParenthesis(self, n: int) -> List[str]: self.res = [] self.backtrace(n, 0, 0, '') return self.res def backtrace(self, n, left, right, item): if right == n and left == n:

2020-08-04 20:23:08

40. 组合总和 II

class Solution: def combinationSum2(self, candidates, target: int): self.res = [] item = [] i = 0 candidates.sort() check = [0 for i in range(len(candidates))] self.backtrace(candidates,target, item, i, c

2020-08-03 07:01:27

51. N皇后

import copyclass Solution: def solveNQueens(self, n: int): res = [] squre = [[0 for i in range(n)] for j in range(n)]#皇后的攻击范围 sit = [['.' for i in range(n)] for j in range(n)] #皇后的位置 self.backtrace(0, n, sit, squre, res

2020-08-03 07:00:51

315. 计算右侧小于当前元素的个数

class Solution: def countSmaller(self, nums: List[int]) -> List[int]: counts = [0]*len(nums)#结果数组 index = [i for i in range(len(nums))]#索引数组 def merge_sort(arr,low,high): mid = (low + high) // 2 if hig

2020-08-03 07:00:05

70. 爬楼梯

public class Solution { public int climbStairs(int n) { if (n == 1) { return 1; } int[] dp = new int[n + 1]; dp[1] = 1; dp[2] = 2; for (int i = 3; i <= n; i++) { dp[i] = dp[i -

2020-08-03 06:59:20

35. 搜索插入位置

class Solution: def searchInsert(self, nums: List[int], target: int) -> int: left = 0 right = len(nums) - 1 self.idx = 0 self.divide(nums, left, right,target) return self.idx def divide(self, nums, le

2020-08-03 06:58:36

34. 在排序数组中查找元素的第一个和最后一个位置

class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: self.small = len(nums) - 1 self.big = 0 self.find = False left = 0 right = len(nums) - 1 self.divide(nums, target, lef

2020-08-03 06:57:58

33. 搜索旋转排序数组

class Solution: def search(self, nums: List[int], target: int) -> int: left = 0 right = len(nums) - 1 self.idx = -1 self.divide(nums, left, right, target) return self.idx def divide(self, nums, left,

2020-08-03 06:57:17

449. 序列化和反序列化二叉搜索树

import sysclass Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string. """ if not root: return '' self.res = [] self.preoder(root) return '#'.join(self.r

2020-08-03 06:56:48

409. 最长回文串

class Solution: def longestPalindrome(self, s: str) -> int: if not s: return 0 dic = {} for i in s: if i in dic: dic[i] += 1 else: dic[i] = 1 countA

2020-08-03 06:55:57

查看更多

勋章 我的勋章
  • 阅读者勋章Lv1
    阅读者勋章Lv1
    授予在CSDN APP累计阅读博文达到3天的你,是你的坚持与努力,使你超越了昨天的自己。
  • 持之以恒
    持之以恒
    授予每个自然月内发布4篇或4篇以上原创或翻译IT博文的用户。不积跬步无以至千里,不积小流无以成江海,程序人生的精彩需要坚持不懈地积累!
  • 勤写标兵Lv4
    勤写标兵Lv4
    授予每个自然周发布9篇以上(包括9篇)原创IT博文的用户。本勋章将于次周周三上午根据用户上周的博文发布情况由系统自动颁发。
  • 分享小兵
    分享小兵
    成功上传3个资源即可获取