leetcode核心思想:双指针,数字小的那个指针移动classSolution{public:intmaxArea(vector&height){intleft=0;intright=height.size()-1;intmaxArea=0;while(left
《算法》四学习——1.1节
进阶的Farmer
算法算法笔记
前言买了一本算法4,每天看一点,对每个小结来个学习总结,输出驱动输入。本篇笔记针对第一章基础1.1基础编程模型1.1节总结了相关的语法、语言特性和书中将会用到的库。笔记自己在编码中容易遗漏的点&&优先级比||高在开发中习惯了加括号,所以没注意到这点,教材上也有但是忘记了二分查找中计算mid=left+(right-left)/2这样计算可以有效避免(left+right)/2溢出答疑java无穷大
多表查询_关联查询
活跃家族
sql
innerjoin:通常关联项on后面的是主外键,两个表都有的才显示leftjoin:左连,select*fromSleftjoinBons.字段=B.字段,一定会将左边表的数据全部查询出来rightjoin:select*fromSrightjoinBons.字段=B.字段一定会将右边表的数据全部查询出来索引:增加查询效率,数据量很大的时候,提高查询速度,当给表加索引之后,重新插入数据,就会让索
html ul点击删除,用原生实现点击删除点击的li
weixin_39993454
htmlul点击删除
简单的实现方式#button{display:inline-block;}ul{list-style:none;}li{background-color:red;display:inline-block;width:20px;padding:10px;margin-left:3px;color:white;}window.onload=function(){varoBtn1=document.ge
【十一】【SQL】外连接(左外连接,右外连接)
妖精七七_
数据库SQL数据库sql
数据库中的外连接(OuterJoin)用于连接两个表,并包括两个表中的匹配行以及左表(LEFTJOIN)或右表(RIGHTJOIN)中未匹配的行。外连接分为两种主要类型:左外连接(LEFTOUTERJOIN):返回左表(FROM子句中第一个表)的所有行,即使在右表中没有匹配的行。如果右表中没有匹配的行,则结果集中右表的部分将包含NULL值。右外连接(RIGHTOUTERJOIN):返回右表(JOI
小程序开关组件
phoebe_l_
小程序
前提是vant组件库不太好改,干脆就手写了一个{{leftText}}{{rightText}}import{ref,computed}from'vue';constprops=defineProps({leftText:{type:String,default:''},rightText:{type:String,default:''}});constisReverseOrder=ref(tru
Qt QTableWidget 触摸屏上滑动效果
hss2799
Qt
要实现QTableWidget在触摸屏上,滑动记录,记录会跟着滑动,只需要加QScroller*pScroller=QScroller::scroller(tablewidget);pScroller->grabGesture(tablewidget,QScroller::LeftMouseButtonGesture);tablewidget->setVerticalScrollMode(QLis
查找算法--python
电子海鸥
Python数据结构与算法算法python数据结构
二分查找一、概述基于有序数组的一种查找算法,主要使用了分治的思想,在每次查找的过程后,都能缩小一半的搜索范围,比如在1到100内猜数字,在保险的情况下先说50,根据结果再分析范围是1到49、51到100还是就是50,可以大大的减少查询次数。二、查找元素位置步骤设置边界,一般left取0作为左边界,right取lenth-1作为右边界计算mid=(left+right)//2,查看中间值,并和tar
transform-origin设置变形中心点
每一天,每一步
HTML/CSShtmlcsscss3
HTML代码:CSS代码:.box{width:100px;height:100px;background-color:purple;margin-left:150px;transition:all.5s;/*transform-origin:center;默认盒子的正中心为旋转中心点*//*transform-origin:left;设置左边线中心点为旋转中心点*//*transform-ori
LeetCode: 2576. 求出最多标记的下标 排序+双指针,时间复杂度O(n*logn)
忍界英雄
每日一题leetcode算法数据结构
2576.求出最多标记的下标today2576求出最多标记的下标题目描述给你一个下标从0开始的整数数组nums。一开始,所有下标都没有被标记。你可以执行以下操作任意次:选择两个互不相同且未标记的下标i和j,满足2*nums[i]nums[right],则我们需要将right右移一位。直到left或right超出边界条件,我们就找到了所有满足条件的数字对。复杂度分析:时间复杂度为O(nlogn)O(
Leetcode 盛水最多的容器
Wils0nEdwards
leetcode算法职场和发展
算法思路:Explanation:Two-pointertechnique:Startwithtwopointers,oneatthebeginning(left)andoneattheend(right)oftheheightarray.Calculatetheareaformedbetweenthetwoverticallines.Theareaiscalculatedas:Area=(rig
【C++】——初识模版
我爱吃福鼎肉片
c++算法c语言
文章目录前言函数模版函数模版的原理函数模版的实例化类模版类模版的实例化前言当我们使用一个通用的函数://为每一个类型都编写一个重载版本voidSwap(int&left,int&right){inttemp=left;left=right;right=temp;}voidSwap(double&left,double&right){doubletemp=left;left=right;right=
函数完成数组的逆序输出(C语言)
我爱吃福鼎肉片
c语言开发语言
目录函数完成数组的逆序输出一、思路二、源代码运行截图:总结函数完成数组的逆序输出一、思路1.实现print()函数打印数组的每个元素:使用for循环将数组中的元素打印出来。2.实现reverse()函数完成数组元素的逆置:设置left为左下标,right为右下标,tmp为交换两个数内容的中间变量先将下标为left的值赋值给tmp,再将下标为right的值赋值给下标为元素left,最后再将tmp的值
day-54 求出最多标记下标
菜-卷
算法
思路假设nums的长度为len,则返回数最大最大为(len/2)*2,所以可以将数组分为两部分,[0(len-1)/2]为一部分,[(len-1)/2len-]为第二部分解题过程指针right从第二部分从右向左开始遍历,指针left从第一部分从右向左开始遍历,如果满足nums[left]*2=0&&right>(len-1)/2){if(nums[left]*2<=nums[right]){ans
【Hot100】LeetCode—763. 划分字母区间
山脚ice
#Hot100leetcode哈希算法
目录1-思路哈希表+双指针2-实现⭐763.划分字母区间——题解思路3-ACM实现原题链接:763.划分字母区间1-思路哈希表+双指针①找到元素最远的出现位置:哈希表②根据最远出现位置,判断区间的分界线:双指针实现1-定义一个哈希数组,判断最远出现的位置:int[]hash=newint[27]遍历字符串,记录最远出现位置2-分割点利用数组,收集结果intleft=0;intright=0;记录左
如何让echarts中title可以旋转以及在四周加上title
今晚吃什么呢?
echarts前端javascript
需要达到的效果图如下:需要实现这种的效果我们需要用到,graphic这个Api,具体实现:1.在graphic使用elements这个属性;2.设置title需要几个title你就设置几个;3.属性解释:type设置他的类型,可以是文字也可以是其他的。left、bottom、top等是设置他的位置使用center就是居中对齐style是设置他的样式益对象的形式出显;style.tex是设置名称,s
机器学习 第12章 计算学习理论
一只小小程序猿
机器学习人工智能
目录基础知识PAC学习有限假设空间可分情形不可分情形VC维稳定性基础知识计算学习理论研究的是关于通过"计算"来进行"学习"的理论,即关于机器学习的理论基础,其目的是分析学习任务的困难本质,为学习算法提供理论保证,并根据分析结果指导算法设计。给定样例集D={(x1,y1),(x2,y2),…,(xm,ym)}D=\left\{\left(\boldsymbol{x}_{1},y_{1}\right)
CSS (常用样式) 笔记05
不修×蝙蝠
css前端html笔记
一.字体相关1.color:设置字体颜色2.font复合属性:①font-size设置字体大小②font-weight设置字体粗细③font-style设置字体风格e.gitalic斜体normal正常3.文本:①text-decoration设置文本下划线(通常使用none值来消除超链接a的下划线)②text-align规定文本水平对齐方式(left向左,center居中,right靠右)③li
3.引入自定义的组件
jqClub
0.在src/components/left.vue,添加所需要的内容left-contentexportdefault{name:'HelloWorld',data(){return{msg:'WelcometoYourVue.jsApp'}}}1.在src/components/HelloWorld.vue中顶部引入(记住,引入不存在的组件,会直接报错)importleftfrom'./lef
CSS3新特性
FL1623863121
css3前端css
CSS3新特性CSS3是最新的CSS标准,旨在扩展CSS2.1。圆角通过border-radius属性可以给任何元素制作圆角。border-radius:所有四个边角border-*-*-radius属性的缩写。border-top-left-radius:定义了左上角的弧度。border-top-right-radius:定义了右上角的弧度。border-bottom-right-radius:
Python解方程
Flyforever-Tang
Pythonpython
sympy库用着稍微有点问题,解简单的方程还行,稍微复杂点的结果就不太行,要么打印出了一堆奇怪的东西,要么会运行失败。自己写了一个解方程的函数,原理是穷尽搜索解的值,代码如下。left和right是把等式两边变成函数,x_range是解的搜索范围,step是搜索步长,error是允许的误差。importnumpyasnpdefsolve_equation(left,right,x_range:li
CSS学习14[重点]--定位、边偏移、定位模式
乌鸦不像写字台
css学习css学习前端
定位前言一、定位二、定位模式1.静态定位static2.相对定位relative3.绝对定位absolute4.子绝父相5.绝对定位的盒子水平居中6.固定定位(fixed)7.叠放次序(z)三、四种定位总结四、定位模式转换前言为什么学习定位?应用场景:图片上移动的物体、突出的部分、导航栏…一、定位边偏移top:100px;bottom:;left:;right:;定位模式选择器{position:
Error: Could not installed packages due to anOSError: [Errno 28] No space left on device
不废江河954
linux
Error:CouldnotinstalledpackagesduetoanOSError:[Errno28]Nospaceleftondevice前言安装torch时出现标题所示报错。尝试1(失败)可能是磁盘占用过多,查看磁盘占用情况:df-h,发现剩余空间绰绰有余。但还是使用sudoaptautoremove--purgesnapd清理了下。果然没有任何用,继续报同样的错。尝试2(失败)可能是
mysql 把多条符合条件的数组 json 合并成一条
KingFu28
mysqljson
selectc.PROC_INST_ID_,sfj.file_jsonfrombpm_check_opinioncleftjoinsys_file_jsonsfjontimestampdiff(minute,sfj.create_time,c.CREATE_TIME_)between0and3--三分钟内wherec.PROC_INST_ID_='10000005440002';查询结果:1000
图像分割任务在设计模型损失函数时,高斯函数会被如何应用
Wils0nEdwards
计算机视觉人工智能深度学习
什么是高斯函数?Gaussianfunction,又称为高斯函数,是一种常见的数学函数,定义为一种特定形状的钟形曲线。其表达式通常为:f(x)=a⋅exp(−(x−b)22c2)f(x)=a\cdot\exp\left(-\frac{(x-b)^2}{2c^2}\right)f(x)=a⋅exp(−2c2(x−b)2)其中:aaa决定了曲线的高度(峰值)。bbb是曲线中心位置的均值,决定曲线的对
斐波纳契数列(f(n)=f(n-1)+f(n-2))问题
剑海风云
Algorithm算法数列
packageorg.nxt.algorithm.series;importjava.math.BigInteger;/***fibonacciseries*@authornanxiaotao**/publicclassFibonacciSeries{privatestaticBigInteger[][]matrix(BigInteger[][]arrLeft,BigInteger[][]arrR
SQL联表查询LEFT JOIN 数据去重复
培根芝士
SQLsql数据库
使用leftjoin联表查询时,如果table1中的一条记录对应了table2的多条记录,则会重复查出id相同的多条记录。SELECTt1.*FROMtable1t1LEFTJOINtable2t2ONt1.id=t2.tid解决方法:将查询结果作为中间表,使用groupby进行去重SELECTtmp.*FROM(SELECTt1.*FROMtable1t1LEFTJOINtable2t2ONt1
C语言——利用二分法求数组中特定元素的索引,并在函数中引入了冒泡排序,可以求无序数组中的特定元素的索引
万河归海428
算法c语言visualstudio数据结构冒泡二分法数组
#include#includeinterfenfa(int*p,intlen,inttarget){intleft=0;intright=len-1;inti;intj;inttmp;for(i=0;ip[j+1]){tmp=p[j];p[j]=p[j+1];p[j+1]=tmp;}}}while(lefttarget){right=mid-1;}}returnleft;}intmain(){i
6. Fabric 拖拽元素到画布
Lanwarf-前端开发
Fabricfabric前端javascript
监听元素是否被下放到画布上canvas.on('drop',elt=>{//画布元素距离浏览器左侧和顶部的距离letoffset={left:canvas.getSelectionElement().getBoundingClientRect().left,top:canvas.getSelectionElement().getBoundingClientRect().top}//鼠标坐标转换成画
windows下源码安装golang
616050468
golang安装golang环境windows
系统: 64位win7, 开发环境:sublime text 2, go版本: 1.4.1
1. 安装前准备(gcc, gdb, git)
golang在64位系
redis批量删除带空格的key
bylijinnan
redis
redis批量删除的通常做法:
redis-cli keys "blacklist*" | xargs redis-cli del
上面的命令在key的前后没有空格时是可以的,但有空格就不行了:
$redis-cli keys "blacklist*"
1) "blacklist:12:
[email protected]
oracle正则表达式的用法
0624chenhong
oracle正则表达式
方括号表达示
方括号表达式
描述
[[:alnum:]]
字母和数字混合的字符
[[:alpha:]]
字母字符
[[:cntrl:]]
控制字符
[[:digit:]]
数字字符
[[:graph:]]
图像字符
[[:lower:]]
小写字母字符
[[:print:]]
打印字符
[[:punct:]]
标点符号字符
[[:space:]]
2048源码(核心算法有,缺少几个anctionbar,以后补上)
不懂事的小屁孩
2048
2048游戏基本上有四部分组成,
1:主activity,包含游戏块的16个方格,上面统计分数的模块
2:底下的gridview,监听上下左右的滑动,进行事件处理,
3:每一个卡片,里面的内容很简单,只有一个text,记录显示的数字
4:Actionbar,是游戏用重新开始,设置等功能(这个在底下可以下载的代码里面还没有实现)
写代码的流程
1:设计游戏的布局,基本是两块,上面是分
jquery内部链式调用机理
换个号韩国红果果
JavaScriptjquery
只需要在调用该对象合适(比如下列的setStyles)的方法后让该方法返回该对象(通过this 因为一旦一个函数称为一个对象方法的话那么在这个方法内部this(结合下面的setStyles)指向这个对象)
function create(type){
var element=document.createElement(type);
//this=element;
你订酒店时的每一次点击 背后都是NoSQL和云计算
蓝儿唯美
NoSQL
全球最大的在线旅游公司Expedia旗下的酒店预订公司,它运营着89个网站,跨越68个国家,三年前开始实验公有云,以求让客户在预订网站上查询假期酒店时得到更快的信息获取体验。
云端本身是用于驱动网站的部分小功能的,如搜索框的自动推荐功能,还能保证处理Hotels.com服务的季节性需求高峰整体储能。
Hotels.com的首席技术官Thierry Bedos上个月在伦敦参加“2015 Clou
java笔记1
a-john
java
1,面向对象程序设计(Object-oriented Propramming,OOP):java就是一种面向对象程序设计。
2,对象:我们将问题空间中的元素及其在解空间中的表示称为“对象”。简单来说,对象是某个类型的实例。比如狗是一个类型,哈士奇可以是狗的一个实例,也就是对象。
3,面向对象程序设计方式的特性:
3.1 万物皆为对象。
C语言 sizeof和strlen之间的那些事 C/C++软件开发求职面试题 必备考点(一)
aijuans
C/C++求职面试必备考点
找工作在即,以后决定每天至少写一个知识点,主要是记录,逼迫自己动手、总结加深印象。当然如果能有一言半语让他人收益,后学幸运之至也。如有错误,还希望大家帮忙指出来。感激不尽。
后学保证每个写出来的结果都是自己在电脑上亲自跑过的,咱人笨,以前学的也半吊子。很多时候只能靠运行出来的结果再反过来
程序员写代码时就不要管需求了吗?
asia007
程序员不能一味跟需求走
编程也有2年了,刚开始不懂的什么都跟需求走,需求是怎样就用代码实现就行,也不管这个需求是否合理,是否为较好的用户体验。当然刚开始编程都会这样,但是如果有了2年以上的工作经验的程序员只知道一味写代码,而不在写的过程中思考一下这个需求是否合理,那么,我想这个程序员就只能一辈写敲敲代码了。
我的技术不是很好,但是就不代
Activity的四种启动模式
百合不是茶
android栈模式启动Activity的标准模式启动栈顶模式启动单例模式启动
android界面的操作就是很多个activity之间的切换,启动模式决定启动的activity的生命周期 ;
启动模式xml中配置
<activity android:name=".MainActivity" android:launchMode="standard&quo
Spring中@Autowired标签与@Resource标签的区别
bijian1013
javaspring@Resource@Autowired@Qualifier
Spring不但支持自己定义的@Autowired注解,还支持由JSR-250规范定义的几个注解,如:@Resource、 @PostConstruct及@PreDestroy。
1. @Autowired @Autowired是Spring 提供的,需导入 Package:org.springframewo
Changes Between SOAP 1.1 and SOAP 1.2
sunjing
ChangesEnableSOAP 1.1SOAP 1.2
JAX-WS
SOAP Version 1.2 Part 0: Primer (Second Edition)
SOAP Version 1.2 Part 1: Messaging Framework (Second Edition)
SOAP Version 1.2 Part 2: Adjuncts (Second Edition)
Which style of WSDL
【Hadoop二】Hadoop常用命令
bit1129
hadoop
以Hadoop运行Hadoop自带的wordcount为例,
hadoop脚本位于/home/hadoop/hadoop-2.5.2/bin/hadoop,需要说明的是,这些命令的使用必须在Hadoop已经运行的情况下才能执行
Hadoop HDFS相关命令
hadoop fs -ls
列出HDFS文件系统的第一级文件和第一级
java异常处理(初级)
白糖_
javaDAOspring虚拟机Ajax
从学习到现在从事java开发一年多了,个人觉得对java只了解皮毛,很多东西都是用到再去慢慢学习,编程真的是一项艺术,要完成一段好的代码,需要懂得很多。
最近项目经理让我负责一个组件开发,框架都由自己搭建,最让我头疼的是异常处理,我看了一些网上的源码,发现他们对异常的处理不是很重视,研究了很久都没有找到很好的解决方案。后来有幸看到一个200W美元的项目部分源码,通过他们对异常处理的解决方案,我终
记录整理-工作问题
braveCS
工作
1)那位同学还是CSV文件默认Excel打开看不到全部结果。以为是没写进去。同学甲说文件应该不分大小。后来log一下原来是有写进去。只是Excel有行数限制。那位同学进步好快啊。
2)今天同学说写文件的时候提示jvm的内存溢出。我马上反应说那就改一下jvm的内存大小。同学说改用分批处理了。果然想问题还是有局限性。改jvm内存大小只能暂时地解决问题,以后要是写更大的文件还是得改内存。想问题要长远啊
org.apache.tools.zip实现文件的压缩和解压,支持中文
bylijinnan
apache
刚开始用java.util.Zip,发现不支持中文(网上有修改的方法,但比较麻烦)
后改用org.apache.tools.zip
org.apache.tools.zip的使用网上有更简单的例子
下面的程序根据实际需求,实现了压缩指定目录下指定文件的方法
import java.io.BufferedReader;
import java.io.BufferedWrit
读书笔记-4
chengxuyuancsdn
读书笔记
1、JSTL 核心标签库标签
2、避免SQL注入
3、字符串逆转方法
4、字符串比较compareTo
5、字符串替换replace
6、分拆字符串
1、JSTL 核心标签库标签共有13个,
学习资料:http://www.cnblogs.com/lihuiyy/archive/2012/02/24/2366806.html
功能上分为4类:
(1)表达式控制标签:out
[物理与电子]半导体教材的一个小问题
comsci
问题
各种模拟电子和数字电子教材中都有这个词汇-空穴
书中对这个词汇的解释是; 当电子脱离共价键的束缚成为自由电子之后,共价键中就留下一个空位,这个空位叫做空穴
我现在回过头翻大学时候的教材,觉得这个
Flashback Database --闪回数据库
daizj
oracle闪回数据库
Flashback 技术是以Undo segment中的内容为基础的, 因此受限于UNDO_RETENTON参数。要使用flashback 的特性,必须启用自动撤销管理表空间。
在Oracle 10g中, Flash back家族分为以下成员: Flashback Database, Flashback Drop,Flashback Query(分Flashback Query,Flashbac
简单排序:插入排序
dieslrae
插入排序
public void insertSort(int[] array){
int temp;
for(int i=1;i<array.length;i++){
temp = array[i];
for(int k=i-1;k>=0;k--)
C语言学习六指针小示例、一维数组名含义,定义一个函数输出数组的内容
dcj3sjt126com
c
# include <stdio.h>
int main(void)
{
int * p; //等价于 int *p 也等价于 int* p;
int i = 5;
char ch = 'A';
//p = 5; //error
//p = &ch; //error
//p = ch; //error
p = &i; //
centos下php redis扩展的安装配置3种方法
dcj3sjt126com
redis
方法一
1.下载php redis扩展包 代码如下 复制代码
#wget http://redis.googlecode.com/files/redis-2.4.4.tar.gz
2 tar -zxvf 解压压缩包,cd /扩展包 (进入扩展包然后 运行phpize 一下是我环境中phpize的目录,/usr/local/php/bin/phpize (一定要
线程池(Executors)
shuizhaosi888
线程池
在java类库中,任务执行的主要抽象不是Thread,而是Executor,将任务的提交过程和执行过程解耦
public interface Executor {
void execute(Runnable command);
}
public class RunMain implements Executor{
@Override
pub
openstack 快速安装笔记
haoningabc
openstack
前提是要配置好yum源
版本icehouse,操作系统redhat6.5
最简化安装,不要cinder和swift
三个节点
172 control节点keystone glance horizon
173 compute节点nova
173 network节点neutron
control
/etc/sysctl.conf
net.ipv4.ip_forward =
从c面向对象的实现理解c++的对象(二)
jimmee
C++面向对象虚函数
1. 类就可以看作一个struct,类的方法,可以理解为通过函数指针的方式实现的,类对象分配内存时,只分配成员变量的,函数指针并不需要分配额外的内存保存地址。
2. c++中类的构造函数,就是进行内存分配(malloc),调用构造函数
3. c++中类的析构函数,就时回收内存(free)
4. c++是基于栈和全局数据分配内存的,如果是一个方法内创建的对象,就直接在栈上分配内存了。
专门在
如何让那个一个div可以拖动
lingfeng520240
html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml
第10章 高级事件(中)
onestopweb
事件
index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/
计算两个经纬度之间的距离
roadrunners
计算纬度LBS经度距离
要解决这个问题的时候,到网上查了很多方案,最后计算出来的都与百度计算出来的有出入。下面这个公式计算出来的距离和百度计算出来的距离是一致的。
/**
*
* @param longitudeA
* 经度A点
* @param latitudeA
* 纬度A点
* @param longitudeB
*
最具争议的10个Java话题
tomcat_oracle
java
1、Java8已经到来。什么!? Java8 支持lambda。哇哦,RIP Scala! 随着Java8 的发布,出现很多关于新发布的Java8是否有潜力干掉Scala的争论,最终的结论是远远没有那么简单。Java8可能已经在Scala的lambda的包围中突围,但Java并非是函数式编程王位的真正觊觎者。
2、Java 9 即将到来
Oracle早在8月份就发布
zoj 3826 Hierarchical Notation(模拟)
阿尔萨斯
rar
题目链接:zoj 3826 Hierarchical Notation
题目大意:给定一些结构体,结构体有value值和key值,Q次询问,输出每个key值对应的value值。
解题思路:思路很简单,写个类词法的递归函数,每次将key值映射成一个hash值,用map映射每个key的value起始终止位置,预处理完了查询就很简单了。 这题是最后10分钟出的,因为没有考虑value为{}的情