class Solution(object): def arrangeCoins(self, n): """ :type n: int :rtype: int """ return int(2 ** 0.5 * (n + 1 / 8) ** 0.5 - 1 / 2) if __name__ == ' ...
分类:
其他好文 时间:
2020-06-08 14:38:44
阅读次数:
59
class Solution(object): def searchRange(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ # 处理target不在nums中的情况 if ...
分类:
编程语言 时间:
2020-06-08 14:37:23
阅读次数:
54
class Solution(object): def findRadius(self, houses, heaters): """ :type houses: List[int] :type heaters: List[int] :rtype: int """ ans = [] heaters.s ...
分类:
其他好文 时间:
2020-06-08 14:25:21
阅读次数:
49
#解方程 题目链接:https://ac.nowcoder.com/acm/problem/14416 ###涉及知识点: 思维/二分 ###solution: 首先暴力枚举a,b 然后二分找到一个c的值使$ax^{2}+bx=-c$ 时间复杂度O(n^2logn) ###std: #include ...
分类:
其他好文 时间:
2020-06-08 14:19:57
阅读次数:
50
题意:即nums长为n+1,里面的元素值范围:[1,n],有且仅有一个重复值,但该值可以重复多次,所以[1,n]有的数可以不在nums里。 方法一:二分查找。 class Solution(object): # 二分查找 def findDuplicate(self, nums): low = 1 ...
分类:
其他好文 时间:
2020-06-08 14:17:49
阅读次数:
49
#46 全排列 https://leetcode-cn.com/problems/permutations/submissions/ 给定一个 没有重复 数字的序列,返回其所有可能的全排列。 class Solution { public: vector<vector<int>> result; v ...
分类:
其他好文 时间:
2020-06-08 13:05:47
阅读次数:
64
#853 车队 https://leetcode-cn.com/problems/car-fleet/ 这题我并没有使用某个排序算法,只是使用了Vector的可自定义sort方法。 class Solution { public: struct Car { int pos; int speed; f ...
分类:
编程语言 时间:
2020-06-08 12:46:31
阅读次数:
48
##1、在树莓派中安装opencv库 ###(1)安装依赖 sudo apt-get update && sudo apt-get upgrade sudo apt-get install build-essential cmake pkg-config sudo apt-get install l ...
分类:
其他好文 时间:
2020-06-08 10:37:41
阅读次数:
72
Flutter upgrade更新版本引发的无法启动调试APP的错误target:kernel_snapshot failed” ...
分类:
移动开发 时间:
2020-06-07 21:42:06
阅读次数:
395
动态规划 思路: 参考62. 不同路径 代码: class Solution: def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int: m = len(obstacleGrid) n = len(obstac ...
分类:
其他好文 时间:
2020-06-07 15:05:47
阅读次数:
65