[RATS]week-3
Algorithm
Question
给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。
示例 1:
输入: “babad”
输出: “bab”
注意: “aba” 也是一个有效答案。
示例 2:
输入: “cbbd”
输出: “bb”
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/longest-palindromic-substring
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
Answer
public static String longestPalindrome1(String s) {
char[] charArray = s.toCharArray();
int strLength = s.length();
int leftTmp = 0, rightTmp = 0, tmpLength = 0, left = 0, right = 0, length = 0, leftCursor = 0, rightCursor = 0;
for (double i = 0.5; i < strLength; i = i + 0.5) {
leftTmp = (int) Math.floor(i);
rightTmp = (int) Math.ceil(i);
while (leftTmp > -1 && rightTmp < strLength) {
if (charArray[leftTmp--] != charArray[rightTmp++]) {
break;
} else {
left = leftTmp + 1;
right = rightTmp - 1;
}
}
tmpLength = right - left + 1;
if (length < tmpLength) {
length = tmpLength;
leftCursor = left;
rightCursor = right;
}
}
return s.length() == 0 ? "" : s.substring(leftCursor, rightCursor + 1);
}
Result
Review
Spring Cloud - Main Projects
Spring Cloud Security
Provides support for load-balanced OAuth2 rest client and authentication header relays in a Zuul proxy.
安全
提供支持针对负载均和 OAuth2 rest Client 和Zuul proxy(网关代理)中的身份认证头部 的中继支持.
Spring Cloud Sleuth
Distributed tracing for Spring Cloud applications, compatible with Zipkin, HTrace and log-based (e.g. ELK) tracing.
侦查
Spring Cloud应用成的分布式追踪,与Zipkin,HTRace和基于日志追踪(如ELK)等系统的兼容
Spring Cloud Data Flow
A cloud-native orchestration service for composable microservice applications on modern runtimes. Easy-to-use DSL, drag-and-drop GUI, and REST-APIs together simplifies the overall orchestration of microservice based data pipelines.
数据流
运行在主流的运行时的由多个微服务组成的基于本地云的大型综合服务。简单易用的DSL,拖拽的GUI和REST-APIs一起简化了基于数据管线微服务的综合应用
Spring Cloud Stream
A lightweight event-driven microservices framework to quickly build applications that can connect to external systems. Simple declarative model to send and receive messages using Apache Kafka or RabbitMQ between Spring Boot apps.
流
一个轻量级的时间驱动的微服务框架能快速的构建应用,这样就能链接外部系统。通过简洁的声明模型使用Kafka或RabbitMQ来发送和接受来自各各SpringBoot的消息
Spring Cloud Stream App Starters
Spring Cloud Stream App Starters are Spring Boot based Spring Integration applications that provide integration with external systems.
Stream App Starters
Spring Cloud Stream App Starters是基于Spring Boot的Spring 集成应用,来提供外部系统的集成
Spring Cloud Task
A short-lived microservices framework to quickly build applications that perform finite amounts of data processing. Simple declarative for adding both functional and non-functional features to Spring Boot apps.
任务
短生命周期的微服务框架可以快速的构建应用来执行有限数量的数据处理。简单的的声明式添加的功能或非功能话的特性到Spring Boot APPs
Spring Cloud Task App Starters
Spring Cloud Task App Starters are Spring Boot applications that may be any process including Spring Batch jobs that do not run forever, and they end/stop after a finite period of data processing.
Task App Starters
Spring Cloud Task App Starters是Spring Boot 应用,她能处理任何任务,包括永远不会运行Spring批任务,并且可以结束或停止任务在一个有限的数据处理范围内。
Spring Cloud Zookeeper
Service discovery and configuration management with Apache Zookeeper.
Zookeeper
通过Apache Zookeeper服务发现和配置管理
Spring Cloud AWS
Easy integration with hosted Amazon Web Services. It offers a convenient way to interact with AWS provided services using well-known Spring idioms and APIs, such as the messaging or caching API. Developers can build their application around the hosted services without having to care about infrastructure or maintenance.
AWS
简单的继承部署在Amazon Web Service.她提供了便捷的方法与AWS提供的服务通过众所周知的Spring习惯用法and APIs,比如消息或API缓存。开发者可以构建他们的应用围绕托管服务而不必须去关心基础设施或运维。
Spring Cloud Connectors
Makes it easy for PaaS applications in a variety of platforms to connect to backend services like databases and message brokers (the project formerly known as “Spring Cloud”).
连接器
使各种平台的Paas(Platform as a service)应用很方便的链接到后台服务,比如数据库,消息代理(这个项目以前成为Spring Cloud)。
Spring Cloud Starters
Spring Boot-style starter projects to ease dependency management for consumers of Spring Cloud. (Discontinued as a project and merged with the other projects after Angel.SR2.)
Starters
Spring Boot风格的Starter项目来减轻SpringCloud的使用者的依赖管理。(作为一个项目已经不在使用,并且已经在Angel.SR2以后的版本中与其他项目合并)
Spring Cloud CLI
Spring Boot CLI plugin for creating Spring Cloud component applications quickly in Groovy
命令行
Spring Boot命令行插件来使用Groovy快速创建Spring Cloud组件应用。
Spring Cloud Contract
Spring Cloud Contract is an umbrella project holding solutions that help users in successfully implementing the Consumer Driven Contracts approach.
合同
Spring Cloud 合同是一个伞状项目支撑的解决方案,可以帮助用户成功的实现消费者驱动的合同方法。
Spring Cloud Gateway
Spring Cloud Gateway is an intelligent and programmable router based on Project Reactor.
网管
Spring Cloud 网关是一个基于交互式项目的智能且可编程的路由器
Spring Cloud OpenFeign
Spring Cloud OpenFeign provides integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms.
OpenFeign
OpenFeign 提供集成Spring Boot Apps通过自动配置和绑定到Spring环境和其他的惯用的Spring编程模型
Spring Cloud Pipelines
Spring Cloud Pipelines provides an opinionated deployment pipeline with steps to ensure that your application can be deployed in zero downtime fashion and easilly rolled back of something goes wrong.
管线
Pipelines提供了一个可选择的部署管线,来逐步的确定你的应用程序可以非停机部署并且简单的回滚一些错误。
Spring Cloud Function
Spring Cloud Function promotes the implementation of business logic via functions. It supports a uniform programming model across serverless providers, as well as the ability to run standalone (locally or in a PaaS).
功能
Spring Cloud Function提升了业务逻辑功能的实现。他提供跨无服务器提供着的统一的编程模型,也有能力去独立的执行(本地或基于Paas)
Tips - MySQL 更新语句执行顺序
update T set c=c+1 where id=2
日志分为Redo Log和Bin Log。使用WAL(Write-Ahead Log) 策略:先写日志,在写磁盘
Redo Log(Crash-Safe):
1.Inno DB 引擎独有。物理日志,固定大小,超出覆盖原有并重复写入。
2.记录做了具体的某个数据做了那些修改。如c=1 ⇒ c=2
3.SQL 语句经过【连接器】权限验证 ⇒【分析器】语法分析 ⇒【优化器】 ⇒执行计划生成 ⇒【执行器】通过InnoDB接口执行SQL语句
4.InnoDB 记录Redo Log,写入内存,在SQL空闲,先写入磁盘。
5.日志满时,会把要擦除的内容写入数据文件。
6.分两次写入。第一次为prepare,在成功写入Bin Log后,会把状态改为Commit。
Binlog(归档日志)
1.Server层实现,逻辑日志,可追加,不会覆盖原来的日志
2.记录原始逻辑.两种类型sql语句形式和表格形式。如c=c+1.一般都建议用表格形式
具体流程如下
以上摘自极客时间-《MySQL实战45讲》