码迷,mamicode.com
首页 >  
搜索关键字:median of two sorted    ( 17004个结果
5.23 VJ E - Candies and Two Sisters
#include<bits/stdc++.h>#define ll long longusing namespace std;/*题意:A和B两人分n个糖,每人最少一个,且A分得的数量要大于B,只要分奇偶情况输出就行*/int main(){ ll t,n; cin>>t; for(int i=0; ...
分类:其他好文   时间:2020-05-23 13:09:20    阅读次数:51
lc 搜索旋转排序数组
链接:https://leetcode-cn.com/problems/search-in-rotated-sorted-array/ 代码: #include <algorithm> class Solution { public: int search(vector<int>& nums, in ...
分类:编程语言   时间:2020-05-23 00:11:15    阅读次数:50
Two Arrays CodeForces - 1288C
题面:https://vjudge.net/problem/CodeForces-1288C 这道题其实比较难想,据说题解一种方法是组合方法(然而我不会),我来总结总结dp的方法吧。 首先我们采用一个dp数组,dp[i][j][k]:在生成的a,b字符串中,第k个的数字分别是i,j,在满足这种情况下 ...
分类:其他好文   时间:2020-05-21 16:36:28    阅读次数:53
413. Arithmetic Slices
A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the ...
分类:其他好文   时间:2020-05-21 10:33:22    阅读次数:54
33.Search in Rotated Sorted Array
给定一个已排好序的数组,将数组循环移动后,给定一个目标整数,求目标整数是否在数组中,若在,返回下标,否则,返回 -1 ,必须使用 O(log?n)时间复杂度。Input: nums = [4,5,6,7,0,1,2], target = 0Output: 4 思路:题目要求O(log?n)的时间复杂 ...
分类:其他好文   时间:2020-05-20 15:55:12    阅读次数:53
LeetCode 2. 两数相加 Add Two Numbers
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solu ...
分类:其他好文   时间:2020-05-20 12:40:43    阅读次数:58
ReactJS-从另一个组件调用一个组件方法(ReactJS - Call One Component Method From Another Component)
I have two components. I want to call a method of the first component from the second component. How can I do it? Here is my code. First Component cla ...
分类:Web程序   时间:2020-05-20 10:49:28    阅读次数:143
使用docker容器运行Python程序
本文主要阐述基于 "python镜像" 和mysql镜像,利用docker容器搭建python3的系统环境,并运行简单的python程序 一.Python镜像的构造文件、Python程序代码 :one: python镜像的 ps:由于直接pip速度较慢,这里使用了清华源镜像加速 :two: 记录py ...
分类:编程语言   时间:2020-05-19 22:36:01    阅读次数:1195
Redis 数据类型及应用场景
Redis 数据类型及应用场景 一、 redis 特点 所有数据存储在内存中,高速读写 提供丰富多样的数据类型:string、 hash、 set、 sorted set、bitmap、hyperloglog 提供了 AOF 和 RDB 两种数据的持久化保存方式,保证了 Redis 重启后数据不丢失 ...
分类:其他好文   时间:2020-05-19 22:33:22    阅读次数:67
Leetcode练习(Python):树类:第108题:将有序数组转换为二叉搜索树:将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。 本题中,一个高度平衡二叉树是指一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1。
题目: 将有序数组转换为二叉搜索树:将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。 本题中,一个高度平衡二叉树是指一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1。 思路: 因为输入是递增的数组,为了转换成二叉搜索树,因此需要找到整个树的根节点,之后使用递归来的得到每个子树 ...
分类:编程语言   时间:2020-05-19 10:54:56    阅读次数:56
17004条   上一页 1 ... 38 39 40 41 42 ... 1701 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!