【编码#1】蜜蜂采蜜
一朵花有Open和Close两种状态,3只蜜蜂在花Open的时候去采蜜,在花Close的时候回巢,用面向对象技术和Design Pattern方法模拟上面过程,输出如下:
2020-06-24
函数式接口
函数式接口有且仅有一个抽象方法的接口@FunctionalInterface 函数式接口 {代码...} 函数式接口作为方法的参数 {代码...} 函数式接口作为方法的返回值 {代码...} 常用的函数式接口Supplier接口 {代码...} 练习 {代码...} Consumer接口练习Predicate接口negate是取 非!and是短路与or是短路或练习Function接口练习
2021-05-25
minikube 因为互联网长城无法启动 ingress-nginx 解决方案
minikube start --driver=docker --kubernetes-version=v1.23.9 --image-mirror-country cn --registry-mirror=https://hz4anb2p.mirror.aliyuncs.com
2023-01-01
[Leetcode] Isomorphic Strings 同构字符串
Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character ...
2015-09-05
leetcode 409. Longest Palindrome
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.
2017-09-01
PAT_甲级_1132 Cut Integer
看到分割问题,首先想到的是字符串分割,我们采用string s来接受输入的数字,然后将其前半部分分割并转化为整数为a,后半部分分割并转化为整数为B,并将s转化为整数z,如果z%(a*b)==0,输出Yes,否则输出No。
Redis数据导入工具优化过程总结
使用C++开发了一个Redis数据导入工具 从oracle中将所有表数据导入到redis中; 不是单纯的数据导入,每条oracle中的原有记录,需要经过业务逻辑处理, 并添加索引(redis集合); 工具完成后,性能是个瓶颈;
laravel-octane 体验及压测
laravel-octane 必须在 php8 之上运行,无奈本地的 Mamp 最高还是 php7,所以只能用 docker 跑一下啦。创建容器在本地开个docker工作目录,方便映射和编辑项目代码。 {代码...} 这里用 swoole 加持吧, roadrunner 没用过,后面再说。容器部署组件、依赖都在容器中解决 {代码...} {代码...} 安装 composer {代码...} 创...
【ACM组合数学 | 错排公式】写信
题目链接:[链接]题意很简单,但是数据范围偏大。错排公式首先来推导一下错排公式:$$D(n) = n!\sum_{k=0}^{n}\frac{(-1)^k}{k!}$$设一个函数:$$S_i表示一个排列中p_i = i的方案数$$那么我们可以知道:$$D(n) = n! - |\cup_{i=1}^{n}S_i|$$这个表示所有方案数减去至少有一个位置放对的方案数。现在来考虑一下如何处理后...
2023-04-17
cssfloat布局以及其他小技巧
6.2 为什么明明在数字1和2之间敲两个空格 但是网页显示出来它们之间 只有一个空格 ? 那是因为你没有添加   (no break space)
Centos7 k8s 1.18.2 metrics
K8S从1.8版本开始,CPU、内存等资源的metrics信息可以通过 Metrics API来获取,用户可以直接获取这些metrics信息(例如通过执行kubect top命令),HPA使用这些metics信息来实现动态伸缩。本文介绍K8S集群基于metric server的HPA。在开始之前我们需要了解一下Metrics API和Metrics Server。
2021-03-30
Product advanced search implemented in Industry solution
For example, I would like to check whether my user has enough authorization defined by authorization object s_carrid with value actvt = 03.
2020-02-02
手撸golang 仿spring ioc/aop 之6 扫码1
最近阅读 [Spring Boot技术内幕: 架构设计与实现原理] (朱智胜 , 2020.6)本系列笔记拟采用golang练习之Talk is cheap, show me the code.
2021-04-14
471. Encode String with Shortest Length
这道题关键是找sub = abcabc这种可压缩的情况,其中sub = s[i,j]。方法比较巧妙,用sub+sub = abcabcabcabc,找第二个s在s+s里出现的位置,如果不是len(sub),则说明sub有重复,那么就要压缩这个sub,重复次数是len(sub) / indexOf(sub, 1),重复的string用的是之前压缩过的dpi,index = indexOf(sub, 1)。
2017-02-14
css3 loading
css {代码...} dom {代码...}
2017-06-29
leetcode讲解--806. Number of Lines To Write String
We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, it is written on the next line. We are given an array widths, an array where widths[0] is the width...
2018-12-28
Python实现自安全的数据结构
SafeObj对Obj进行包装,返回一个含有同步原语的对象。由于足够抽象,对它的访问行为和对Obj一致。 代码还可以再进行扩展,比如Synchronized怎样怎样访问Obj的method等。
2019-12-09