1609. Even Odd Tree

题目 A binary tree is named Even-Odd if it meets the following conditions: The root of the binary tree is at level index 0, its children are at level index 1, their children are at level index 2, etc.For every even-indexed level, all nodes at the level have odd integer values in strictly increasing order […]

686. 重复叠加字符串匹配【中等】

题目 给定两个字符串 a 和 b,寻找重复叠加字符串 a 的最小次数,使得字符串 b 成为叠加后的字符串 a 的子串,如果不存在则返回 -1。 注意:字符串 “abc” 重复叠加 0 次是 “”,重复叠加 1 次是 “abc”,重复叠加 2 次是 “abcabc”。 示例 1: 输入:a = “abcd”, b = “cdabcdab”输出:3解释:a 重复叠加三遍后为 “abcdabcdabcd”, 此时 b 是其子串。示例 2: 输入:a = “a”, b = “aa”输出:2示例 3: 输入:a = “a”, b = “a”输出:1示例 4: 输入:a = “abc”, b = “wxyz”输出:-1  提示: […]

1154. 一年中的第几天 【简单】

给你一个字符串 date ,按 YYYY-MM-DD 格式表示一个 现行公元纪年法 日期。请你计算并返回该日期是当年的第几天。 通常情况下,我们认为 1 月 1 日是每年的第 1 天,1 月 2 日是每年的第 2 天,依此类推。每个月的天数与现行公元纪年法(格里高利历)一致。 示例 1: 输入:date = “2019-01-09”输出:9示例 2: 输入:date = “2019-02-10”输出:41示例 3: 输入:date = “2003-03-01”输出:60示例 4: 输入:date = “2004-03-01”输出:61  提示: date.length == 10date[4] == date[7] == ‘-‘,其他的 date[i] 都是数字date 表示的范围从 1900 年 1 月 1 日至 2019 年 12 月 31 […]

Java Queues

Queue A collection designed for holding elements prior to processing. Besides basic Collection operations, queues provide additional insertion, extraction, and inspection operations. Each of these methods exists in two forms: one throws an exception if the operation fails, the other returns a special value (either null or false, depending on the operation). The latter form of the insert operation is […]

What’s New in Connector/J 8.0?

https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-whats-new.html Note Connector/J 8.0 was formerly known as Connector/J 6.0; see Changes in MySQL Connector/J 8.0.7 for an explanation of the version number change. This section describes differences between Connector/J 8.0 and Connector/J 5.1. Here is a summary of major new features of Connector/J 8.0 (for details on the differences between the Connector/J 5.1 and 8.0 and […]

Windows 10下安装PostgreSQL 14

下载地址: https://www.postgresql.org/download/windows/ 285M左右,下载后安装在D盘,安装到最后时,出现以下提示: 百度了一下,尝试修改locale为中国香港还是有问题,点击安装文件右键选择使用管理员执行也不行,后面卸载掉,重新正常双击安装,database locale选了开头的C选项后,意外可以了。 Maven依赖: <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> </dependency> 驱动类名: org.postgresql.Driver 连接URL示例: jdbc:postgresql://localhost:5432/postgres 官网14版本文档: https://www.postgresql.org/docs/14/index.html

Java 17 available now

Java 17 LTS is the latest long-term support release for the Java SE platform. JDK 17 binaries are free to use in production and free to redistribute, at no cost, under the Oracle No-Fee Terms and Conditions. JDK 17 will receive updates under these terms, until at least September 2024. JDK 17 Documentation Java Language Updates […]

Kotlin学习(一)初步印象

简介 Kotlin is a modern but already mature programming language aimed to make developers happier. It’s concise, safe, interoperable with Java and other languages, and provides many ways to reuse code between multiple platforms for productive programming. 官网: https://kotlinlang.org/ 最新语言版本: v1.6.10 (当前日期2021-12-18) Learning materials overview You can use the following materials and resources for learning Kotlin: […]

Some Kotlin libraries attached to this project were compiled with a newer Kotlin Compiler and can’t be read. Please update Kotlin plugin.

问题 IDEA提示: Some Kotlin libraries attached to this project were compiled with a newer Kotlin Compiler and can’t be read. Please update Kotlin plugin. 原因 Kotlin插件版本应该是跟Kotlin语言版本对应的,如果出现标题所示错误,那么应该检查以下内容是否匹配: Kotlin插件版本 Kotlin编译器版本 项目中Kotlin插件的相应配置 示例 在IDEA中使用Spring Initializr创建Kotlin项目,结果出现上面的问题,后来发现是项目中Kotlin插件配置中语言和插件版本都是1.6.0,修改与插件版本1.4.21一致后解决。 以下是插件、IDE设置(图中已经有提示模块覆盖了项目设置,这里应该是覆盖了IDE设置) 项目模块中Kotlin插件设置在 build.gradle.kts 文件中: plugins { id(“org.springframework.boot”) version “2.4.13” id(“io.spring.dependency-management”) version “1.0.11.RELEASE” kotlin(“jvm”) version “1.4.21” kotlin(“plugin.spring”) version “1.4.21” }

依赖倒置(Dependency Injection)

将原本的依赖于具体实现的状况转换成依赖于抽象。 或者说高层次的模块不应该依靠低层次模块实现,而是依靠低层次模块的抽象。 好莱坞原则:“Don’t call me; I’ll call you.” 《Inversion of Control Containers and the Dependency Injection pattern》 by Martin Fowler