1 class Solution: 2 def numberOfSubstrings(self, s: str) -> int: 3 n = len(s) 4 prelist = [] 5 for i in range(n): 6 a_index = s.find('a',i) 7 b_index ...
分类:
其他好文 时间:
2020-02-23 14:22:06
阅读次数:
55
给定两个大小为 m 和 n 的有序数组?nums1 和?nums2。 请你找出这两个有序数组的中位数,并且要求算法的时间复杂度为?O(log(m + n))。 你可以假设?nums1?和?nums2?不会同时为空 示例 1: 则中位数是 2.0 示例 2: 则中位数是 (2 + 3)/2 = 2.5 ...
分类:
编程语言 时间:
2020-02-23 09:54:57
阅读次数:
70
LeetCode 0034. Find First and Last Position of Element in Sorted Array在排序数组中查找元素的第一个和最后一个位置【Medium】【Python】【二分】 Problem "LeetCode" Given an array of i ...
分类:
编程语言 时间:
2020-02-23 09:45:30
阅读次数:
68
题目描述首先明确一下题意,先输入两个整数n、m,n代表在区间[-1e9,1e9]某一点加一个整数的次数,输入x c在x处加上c,m代表求某个区间和的次数,输入l r求区间[l,r]的和。 分析分析一下y总的代码。 主要分为5大步:1.读输入。将每次读入的x c push_back()到add中,将每 ...
一、并查集的定义 1. 并查集是一种维护集合的数据结构,它的名字中“并”、“查”、“集”。分别取自Union(合并)、Find(查找)、Set(集合)。 合并:就是合并两个集合 查找:判断两个元素是否在一个集合 那么并查集是用什么实现的,就是一个数组, 对于同一个集合来说只存在一个根结点,且将其作为 ...
分类:
其他好文 时间:
2020-02-23 00:08:03
阅读次数:
94
LinkList中遍历操作与删除操作混合使用 删除成功后,list.current()返回什么值? #include <iostream> #include "LinkList.h" using namespace std; using namespace DTLib; int main() { L ...
分类:
其他好文 时间:
2020-02-22 15:33:13
阅读次数:
48
include using namespace std; const int maxn=2e5+10; int fi[maxn],ne[maxn],v[maxn],w[maxn]; struct re { int x,y,z; }; re a[maxn]; int fa[maxn]; int t= ...
分类:
其他好文 时间:
2020-02-22 14:11:54
阅读次数:
90
一、背景: 在win10系统使用systeminfo命令可以查看windows系统信息,但是,默认显示的是全部信息,由于显示内容过多,这对查看特定信息带来一定麻烦。考虑使用该命令时能否使用过滤功能,直接显示指定信息,如“系统启动时间”。 二、方法: 使用systeminfo /?查看该命令自身所带参 ...
meet 大概思路就是 , 找出相交的路径 , 判断方向 , 分类讨论。。 假设已经找出了相交路径 。。。 若方向相同 , 则找到相交路径上边权的最大值 , 若最大值 出发时间差 , 则可行。 原因: 由于方向相同所以在相交路径上这两个点的相对距离是不变的,看最大的边权即可。 这个东西用st表就可以 ...
分类:
其他好文 时间:
2020-02-22 09:55:15
阅读次数:
72
1 """ 2 Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of ...
分类:
其他好文 时间:
2020-02-22 00:41:15
阅读次数:
83