-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
135 lines (130 loc) · 39.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!doctype html>
<html lang="zh"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><meta><title>吾途 - Studeyang.tech</title><link rel="manifest" href="/manifest.json"><meta name="application-name" content="吾途 - Studeyang.tech"><meta name="msapplication-TileImage" content="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202306152245106.gif"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-title" content="吾途 - Studeyang.tech"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="description" content="愿你出走半生,归来仍是少年"><meta property="og:type" content="blog"><meta property="og:title" content="吾途 - Studeyang.tech"><meta property="og:url" content="https://studeyang.tech/"><meta property="og:site_name" content="吾途 - Studeyang.tech"><meta property="og:description" content="愿你出走半生,归来仍是少年"><meta property="og:locale" content="zh_CN"><meta property="og:image" content="https://studeyang.tech/img/og_image.png"><meta property="article:author" content="Studeyang"><meta property="article:tag" content="程序员"><meta property="article:tag" content="编程"><meta property="article:tag" content="架构"><meta property="article:tag" content="技术"><meta property="twitter:card" content="summary"><meta property="twitter:image:src" content="https://studeyang.tech/img/og_image.png"><meta property="twitter:creator" content="@studeyang"><meta property="twitter:site" content="studeyang"><script type="application/ld+json">{"@context":"https://schema.org","@type":"BlogPosting","mainEntityOfPage":{"@type":"WebPage","@id":"https://studeyang.tech"},"headline":"吾途 - Studeyang.tech","image":["https://studeyang.tech/img/og_image.png"],"author":{"@type":"Person","name":"Studeyang"},"publisher":{"@type":"Organization","name":"吾途 - Studeyang.tech","logo":{"@type":"ImageObject","url":"https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202306152245106.gif"}},"description":"愿你出走半生,归来仍是少年"}</script><link rel="alternate" href="/rss2.xml" title="吾途 - Studeyang.tech" type="application/atom+xml"><link rel="icon" href="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202306152245106.gif"><link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.0.0/css/all.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/styles/atom-one-light.css"><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;600&family=Source+Code+Pro"><link rel="stylesheet" href="/css/default.css"><style>body>.footer,body>.navbar,body>.section{opacity:0}</style><!--!--><script>var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?63dd71367176b52c6d8aa50635993633";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();</script><!--!--><script src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" defer></script><!--!--><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/build/cookieconsent.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/lightgallery.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/justifiedGallery.min.css"><script src="https://www.googletagmanager.com/gtag/js?id=G-S5KBWPGHG0" async></script><script>window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-S5KBWPGHG0');</script><!--!--><style>.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.pace-inactive{display:none}.pace .pace-progress{background:#3273dc;position:fixed;z-index:2000;top:0;right:100%;width:100%;height:2px}</style><script src="https://cdn.jsdelivr.net/npm/[email protected]/pace.min.js"></script><!--!--><!--!--><meta name="follow.it-verification-code" content="sJJglrwTzTnwgJhRKl2Z"><!-- hexo injector head_end start --><script>
(function () {
function switchTab() {
if (!location.hash) {
return;
}
const id = '#' + CSS.escape(location.hash.substring(1));
const $tabMenu = document.querySelector(`.tabs a[href="${id}"]`);
if (!$tabMenu) {
return;
}
const $tabMenuContainer = $tabMenu.parentElement.parentElement;
Array.from($tabMenuContainer.children).forEach($menu => $menu.classList.remove('is-active'));
Array.from($tabMenuContainer.querySelectorAll('a'))
.map($menu => document.getElementById($menu.getAttribute("href").substring(1)))
.forEach($content => $content.classList.add('is-hidden'));
if ($tabMenu) {
$tabMenu.parentElement.classList.add('is-active');
}
const $activeTab = document.querySelector(id);
if ($activeTab) {
$activeTab.classList.remove('is-hidden');
}
}
switchTab();
window.addEventListener('hashchange', switchTab, false);
})();
</script><!-- hexo injector head_end end --><meta name="generator" content="Hexo 6.3.0"></head><body class="is-3-column"><nav class="navbar navbar-main"><div class="container navbar-container"><div class="navbar-brand justify-content-center"><a class="navbar-item navbar-logo" href="/"><img src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202306152245106.gif" alt="吾途 - Studeyang.tech" height="28"></a></div><div class="navbar-menu"><div class="navbar-start"><a class="navbar-item is-active" href="/">主页</a><a class="navbar-item" href="/technotes">学习笔记</a><a class="navbar-item" href="/about">关于我</a></div><div class="navbar-end"><a class="navbar-item" target="_blank" rel="noopener" title="Download on GitHub" href="https://github.com/studeyang/studeyang.tech"><i class="fab fa-github"></i></a><a class="navbar-item search" title="搜索" href="javascript:;"><i class="fas fa-search"></i></a></div></div></div></nav><section class="section"><div class="container"><div class="columns"><div class="column order-2 column-main is-8-tablet is-8-desktop is-6-widescreen"><div class="card"><div class="card-image"><a class="image is-7by3" href="/2024/0803.html"><img class="fill" src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2024/202408022243347.jpeg" alt="【译】Apache Shiro介绍"></a></div><article class="card-content article" role="article"><div class="article-meta is-size-7 is-uppercase level is-mobile"><div class="level-left"><span class="level-item"><time dateTime="2024-08-03T01:00:00.000Z" title="2024/8/3 上午9:00:00">2024-08-03</time>发表</span><span class="level-item"><time dateTime="2024-08-02T14:46:23.598Z" title="2024/8/2 下午10:46:23">2024-08-02</time>更新</span><span class="level-item"><a class="link-muted" href="/categories/technotes/">technotes</a></span><span class="level-item">29 分钟读完 (大约4400个字)</span></div></div><p class="title is-3 is-size-4-mobile"><a class="link-muted" href="/2024/0803.html">【译】Apache Shiro介绍</a></p><div class="content"><h2 id="一、什么是-Apache-Shiro?"><a href="#一、什么是-Apache-Shiro?" class="headerlink" title="一、什么是 Apache Shiro?"></a>一、什么是 Apache Shiro?</h2><p>Apache Shiro 是一个功能强大且易于使用的 Java 安全框架,表现在身份认证、授权、加密和会话管理,可用于保护任何应用程序,小到命令行应用程序、移动应用程序,大到 Web 和企业应用程序。</p>
<p>应用程序安全性的 4 个基石:</p>
<ul>
<li>身份验证 - 证明用户身份,通常称为用户“登录”</li>
<li>授权 - 访问控制</li>
<li>加密 - 保护或隐藏数据免遭窥探</li>
<li>会话管理 - 每个用户的时间敏感状态</li>
</ul></div><a class="article-more button is-small is-size-7" href="/2024/0803.html#more">阅读更多</a></article></div><div class="card"><div class="card-image"><a class="image is-7by3" href="/2024/0725.html"><img class="fill" src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2024/202407252241818.jpg" alt="MySQL是如何给表加字段的?"></a></div><article class="card-content article" role="article"><div class="article-meta is-size-7 is-uppercase level is-mobile"><div class="level-left"><span class="level-item"><time dateTime="2024-07-25T14:00:00.000Z" title="2024/7/25 下午10:00:00">2024-07-25</time>发表</span><span class="level-item"><time dateTime="2024-08-02T14:37:50.167Z" title="2024/8/2 下午10:37:50">2024-08-02</time>更新</span><span class="level-item"><a class="link-muted" href="/categories/technotes/">technotes</a></span><span class="level-item">15 分钟读完 (大约2266个字)</span></div></div><p class="title is-3 is-size-4-mobile"><a class="link-muted" href="/2024/0725.html">MySQL是如何给表加字段的?</a></p><div class="content"><p>在我最近的项目中,经常会有给大表加字段的需求,这个过程非常耗时。</p>
<p><img src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2024/202407251951545.png"></p>
<p>可以看到,900 万数据量的一张表,加一个字段就需要 3 个小时左右。</p>
<p>我们知道,给一个表加字段,或者修改字段,或者加索引,需要扫描全表的数据。假设表数据量比较大,加字段的过程将会非常耗时。</p>
<p>不过我最关心的是,在加字段的过程中,会不会对业务的增删改查造成影响?在询问 DBA 后,他给出的答复是不会造成影响。这不禁让我思考这背后的实现原理。</p>
<p>下面,我们就来一探究竟。</p></div><a class="article-more button is-small is-size-7" href="/2024/0725.html#more">阅读更多</a></article></div><div class="card"><div class="card-image"><a class="image is-7by3" href="/2024/0705.html"><img class="fill" src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2024/202407052309418.png" alt="MyBatis拦截器在实际项目中的应用"></a></div><article class="card-content article" role="article"><div class="article-meta is-size-7 is-uppercase level is-mobile"><div class="level-left"><span class="level-item"><time dateTime="2024-07-05T01:00:00.000Z" title="2024/7/5 上午9:00:00">2024-07-05</time>发表</span><span class="level-item"><time dateTime="2024-07-05T15:20:00.655Z" title="2024/7/5 下午11:20:00">2024-07-05</time>更新</span><span class="level-item"><a class="link-muted" href="/categories/technotes/">technotes</a></span><span class="level-item">13 分钟读完 (大约1881个字)</span></div></div><p class="title is-3 is-size-4-mobile"><a class="link-muted" href="/2024/0705.html">MyBatis拦截器在实际项目中的应用</a></p><div class="content"><p>MyBatis 是一个流行的 Java 持久层框架,它简化了数据库访问的复杂性,为开发者提供了强大的功能。其中,MyBatis 拦截器是一个非常有用的特性,可以帮助开发者灵活地解决各种问题。</p>
<p>本文将探讨 MyBatis 拦截器在实际项目中的应用场景和具体实现方法。</p>
<blockquote>
<p>文中代码:<a target="_blank" rel="noopener" href="https://github.com/studeyang/mybatis-interceptor-demo">https://github.com/studeyang/mybatis-interceptor-demo</a></p>
</blockquote></div><a class="article-more button is-small is-size-7" href="/2024/0705.html#more">阅读更多</a></article></div><div class="card"><div class="card-image"><a class="image is-7by3" href="/2023/1124.html"><img class="fill" src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/4881406_2724_4.jpg" alt="Kafka 位移提交的正确姿势"></a></div><article class="card-content article" role="article"><div class="article-meta is-size-7 is-uppercase level is-mobile"><div class="level-left"><span class="level-item"><time dateTime="2023-11-24T01:00:00.000Z" title="2023/11/24 上午9:00:00">2023-11-24</time>发表</span><span class="level-item"><time dateTime="2023-11-24T14:10:37.947Z" title="2023/11/24 下午10:10:37">2023-11-24</time>更新</span><span class="level-item"><a class="link-muted" href="/categories/technotes/">technotes</a></span><span class="level-item">8 分钟读完 (大约1146个字)</span></div></div><p class="title is-3 is-size-4-mobile"><a class="link-muted" href="/2023/1124.html">Kafka 位移提交的正确姿势</a></p><div class="content"><p>你说你 Kafka 用了很多年了,但是位移提交的这些细节你未必清楚。</p>
<p>不久前有个同事出去面试了,他说在 Kafka 问题上被面试官藐视了。</p></div><a class="article-more button is-small is-size-7" href="/2023/1124.html#more">阅读更多</a></article></div><div class="card"><div class="card-image"><a class="image is-7by3" href="/2023/0912.html"><img class="fill" src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202309112237318.jpg" alt="Spring Security入门:保护Web应用"></a></div><article class="card-content article" role="article"><div class="article-meta is-size-7 is-uppercase level is-mobile"><div class="level-left"><span class="level-item"><time dateTime="2023-09-12T01:00:00.000Z" title="2023/9/12 上午9:00:00">2023-09-12</time>发表</span><span class="level-item"><time dateTime="2023-09-19T16:02:57.815Z" title="2023/9/20 上午12:02:57">2023-09-20</time>更新</span><span class="level-item"><a class="link-muted" href="/categories/technotes/">technotes</a></span><span class="level-item">14 分钟读完 (大约2110个字)</span></div></div><p class="title is-3 is-size-4-mobile"><a class="link-muted" href="/2023/0912.html">Spring Security入门:保护Web应用</a></p><div class="content"><p>本文我们将构建一个简单但完整的小型 Web 应用程序,以演示 Spring Security 的入门教程。大致逻辑是:当合法用户成功登录系统之后,浏览器会跳转到一个系统主页,并展示一些个人健康档案(HealthRecord)数据。</p>
<p>让我们开始吧!</p></div><a class="article-more button is-small is-size-7" href="/2023/0912.html#more">阅读更多</a></article></div><div class="card"><div class="card-image"><a class="image is-7by3" href="/2023/0911.html"><img class="fill" src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202309102143620.png" alt="今日算法13-剪绳子"></a></div><article class="card-content article" role="article"><div class="article-meta is-size-7 is-uppercase level is-mobile"><div class="level-left"><span class="level-item"><time dateTime="2023-09-11T01:00:00.000Z" title="2023/9/11 上午9:00:00">2023-09-11</time>发表</span><span class="level-item"><time dateTime="2023-09-10T13:49:16.952Z" title="2023/9/10 下午9:49:16">2023-09-10</time>更新</span><span class="level-item"><a class="link-muted" href="/categories/%E4%BB%8A%E6%97%A5%E7%AE%97%E6%B3%95/">今日算法</a></span><span class="level-item">5 分钟读完 (大约719个字)</span></div></div><p class="title is-3 is-size-4-mobile"><a class="link-muted" href="/2023/0911.html">今日算法13-剪绳子</a></p><div class="content"><h2 id="一、题目描述"><a href="#一、题目描述" class="headerlink" title="一、题目描述"></a>一、题目描述</h2><blockquote>
<p>题目链接:<a target="_blank" rel="noopener" href="https://leetcode.cn/problems/jian-sheng-zi-lcof/">https://leetcode.cn/problems/jian-sheng-zi-lcof/</a></p>
<p>难易程度:中等</p>
</blockquote>
<p>给你一根长度为 n 的绳子,请把绳子剪成整数长度的 m 段(m、n 都是整数,n > 1 并且 m > 1),每段绳子的长度记为 <code>k[0],k[1]...k[m-1]</code> 。请问 <code>k[0]*k[1]*...*k[m-1]</code> 可能的最大乘积是多少?例如,当绳子的长度是 8 时,我们把它剪成长度分别为 2、3、3 的三段,此时得到的最大乘积是 18。</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">输入: 10</span><br><span class="line">输出: 36</span><br><span class="line">解释: 10 = 3 + 3 + 4, 3 × 3 × 4 = 36</span><br></pre></td></tr></table></figure></div><a class="article-more button is-small is-size-7" href="/2023/0911.html#more">阅读更多</a></article></div><div class="card"><div class="card-image"><a class="image is-7by3" href="/2023/0803.html"><img class="fill" src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202308022332512.jpeg" alt="程序员的修炼-知识与体系"></a></div><article class="card-content article" role="article"><div class="article-meta is-size-7 is-uppercase level is-mobile"><div class="level-left"><span class="level-item"><time dateTime="2023-08-03T01:00:00.000Z" title="2023/8/3 上午9:00:00">2023-08-03</time>发表</span><span class="level-item"><time dateTime="2023-08-02T15:40:10.087Z" title="2023/8/2 下午11:40:10">2023-08-02</time>更新</span><span class="level-item"><a class="link-muted" href="/categories/technotes/">technotes</a></span><span class="level-item">18 分钟读完 (大约2722个字)</span></div></div><p class="title is-3 is-size-4-mobile"><a class="link-muted" href="/2023/0803.html">程序员的修炼-知识与体系</a></p><div class="content"><p>本文来自我最近正在学习的课程,极客时间胡峰的专栏文章《程序员进阶攻略》,内容如下。</p>
<p>今年年初,我学习了梁宁的《产品思维》课,其中有一篇叫《点线面体的战略选择》,我觉得特别有感触。虽然是讲产品,但假如把个人的成长当成产品演进一样来发展,会有一种异曲同工、殊途同归之感。</p>
<p>在我工作的经历中就曾碰到过这么一个人,他一开始做了几年开发,从前端到后端,后来又转做测试,接触的“点”倒是不少,但却没能连接起来形成自己的体系,那他个人最大的价值就局限在最后所在的“点”上了。</p>
<p>其实个人的成长有很多方面,但对于程序员的成长最重要的就是知识体系的构建,这其实就是一个 “点线面体” 的演进过程。</p>
<p>下面我会结合自己的成长路线来梳理下这个体系的建立过程。</p></div><a class="article-more button is-small is-size-7" href="/2023/0803.html#more">阅读更多</a></article></div><div class="card"><div class="card-image"><a class="image is-7by3" href="/2023/0802.html"><img class="fill" src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202307302248361.png" alt="今日算法12-矩阵中的路径"></a></div><article class="card-content article" role="article"><div class="article-meta is-size-7 is-uppercase level is-mobile"><div class="level-left"><span class="level-item"><time dateTime="2023-08-02T01:00:00.000Z" title="2023/8/2 上午9:00:00">2023-08-02</time>发表</span><span class="level-item"><time dateTime="2023-07-30T14:52:14.878Z" title="2023/7/30 下午10:52:14">2023-07-30</time>更新</span><span class="level-item"><a class="link-muted" href="/categories/%E4%BB%8A%E6%97%A5%E7%AE%97%E6%B3%95/">今日算法</a></span><span class="level-item">5 分钟读完 (大约687个字)</span></div></div><p class="title is-3 is-size-4-mobile"><a class="link-muted" href="/2023/0802.html">今日算法12-矩阵中的路径</a></p><div class="content"><h2 id="一、题目描述"><a href="#一、题目描述" class="headerlink" title="一、题目描述"></a>一、题目描述</h2><blockquote>
<p>题目链接:<a target="_blank" rel="noopener" href="https://leetcode.cn/problems/ju-zhen-zhong-de-lu-jing-lcof/">https://leetcode.cn/problems/ju-zhen-zhong-de-lu-jing-lcof/</a></p>
<p>难易程度:中等</p>
</blockquote>
<p>给定一个 <code>m x n</code> 二维字符网格 <code>board</code> 和一个字符串单词 <code>word</code> 。如果 <code>word</code> 存在于网格中,返回 <code>true</code> ;否则,返回 <code>false</code> 。</p>
<p>例如,在下面的 3×4 的矩阵中包含单词 “ABCCED”(单词中的字母已标出)。</p>
<p><img src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202307302242023.png"></p>
<p>示例:</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">输入:board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"</span><br><span class="line">输出:true</span><br></pre></td></tr></table></figure></div><a class="article-more button is-small is-size-7" href="/2023/0802.html#more">阅读更多</a></article></div><div class="card"><div class="card-image"><a class="image is-7by3" href="/2023/0801.html"><img class="fill" src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202307302209840.png" alt="今日算法11-旋转数组的最小数字"></a></div><article class="card-content article" role="article"><div class="article-meta is-size-7 is-uppercase level is-mobile"><div class="level-left"><span class="level-item"><time dateTime="2023-08-01T01:00:00.000Z" title="2023/8/1 上午9:00:00">2023-08-01</time>发表</span><span class="level-item"><time dateTime="2023-07-30T14:35:03.996Z" title="2023/7/30 下午10:35:03">2023-07-30</time>更新</span><span class="level-item"><a class="link-muted" href="/categories/%E4%BB%8A%E6%97%A5%E7%AE%97%E6%B3%95/">今日算法</a></span><span class="level-item">5 分钟读完 (大约698个字)</span></div></div><p class="title is-3 is-size-4-mobile"><a class="link-muted" href="/2023/0801.html">今日算法11-旋转数组的最小数字</a></p><div class="content"><h2 id="一、题目描述"><a href="#一、题目描述" class="headerlink" title="一、题目描述"></a>一、题目描述</h2><blockquote>
<p>题目链接:<a target="_blank" rel="noopener" href="https://leetcode.cn/problems/xuan-zhuan-shu-zu-de-zui-xiao-shu-zi-lcof">https://leetcode.cn/problems/xuan-zhuan-shu-zu-de-zui-xiao-shu-zi-lcof</a></p>
<p>难易程度:简单</p>
</blockquote>
<p>把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。</p>
<p>给你一个可能存在 重复 元素值的数组 numbers ,它原来是一个升序排列的数组,并按上述情形进行了一次旋转。请返回旋转数组的最小元素。例如,数组 [3,4,5,1,2] 为 [1,2,3,4,5] 的一次旋转,该数组的最小值为 1。</p>
<p>注意,数组 [a[0], a[1], a[2], …, a[n-1]] 旋转一次 的结果为数组 [a[n-1], a[0], a[1], a[2], …, a[n-2]] 。</p>
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/0038204c-4b8a-42a5-921d-080f6674f989.png" width="210px"> </div>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">示例1:</span><br><span class="line">输入:numbers = [3,4,5,1,2]</span><br><span class="line">输出:1</span><br><span class="line"></span><br><span class="line">示例2:</span><br><span class="line">输入:numbers = [2,2,2,0,1]</span><br><span class="line">输出:0</span><br></pre></td></tr></table></figure></div><a class="article-more button is-small is-size-7" href="/2023/0801.html#more">阅读更多</a></article></div><div class="card"><div class="card-image"><a class="image is-7by3" href="/2023/0731.html"><img class="fill" src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202307302149261.png" alt="今日算法10-变态跳台阶"></a></div><article class="card-content article" role="article"><div class="article-meta is-size-7 is-uppercase level is-mobile"><div class="level-left"><span class="level-item"><time dateTime="2023-07-31T01:00:00.000Z" title="2023/7/31 上午9:00:00">2023-07-31</time>发表</span><span class="level-item"><time dateTime="2023-07-30T14:39:56.631Z" title="2023/7/30 下午10:39:56">2023-07-30</time>更新</span><span class="level-item"><a class="link-muted" href="/categories/%E4%BB%8A%E6%97%A5%E7%AE%97%E6%B3%95/">今日算法</a></span><span class="level-item">4 分钟读完 (大约621个字)</span></div></div><p class="title is-3 is-size-4-mobile"><a class="link-muted" href="/2023/0731.html">今日算法10-变态跳台阶</a></p><div class="content"><h2 id="一、题目描述"><a href="#一、题目描述" class="headerlink" title="一、题目描述"></a>一、题目描述</h2><blockquote>
<p>题目链接:<a target="_blank" rel="noopener" href="https://www.nowcoder.com/practice/22243d016f6b47f2a6928b4313c85387?tpId=13&tqId=11162&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github">牛客网</a></p>
<p>难易程度:简单</p>
</blockquote>
<p>一只青蛙一次可以跳上 1 级台阶,也可以跳上 2 级… 它也可以跳上 n 级。求该青蛙跳上一个 n 级的台阶总共有多少种跳法。</p>
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/cd411a94-3786-4c94-9e08-f28320e010d5.png" width="380px"> </div><br></div><a class="article-more button is-small is-size-7" href="/2023/0731.html#more">阅读更多</a></article></div><nav class="pagination" role="navigation" aria-label="pagination"><div class="pagination-previous is-invisible is-hidden-mobile"><a href="/page/0/">上一页</a></div><div class="pagination-next"><a href="/page/2/">下一页</a></div><ul class="pagination-list is-hidden-mobile"><li><a class="pagination-link is-current" href="/">1</a></li><li><a class="pagination-link" href="/page/2/">2</a></li><li><span class="pagination-ellipsis">…</span></li><li><a class="pagination-link" href="/page/5/">5</a></li></ul></nav></div><div class="column column-left is-4-tablet is-4-desktop is-3-widescreen order-1"><div class="card widget" data-type="profile"><div class="card-content"><nav class="level"><div class="level-item has-text-centered flex-shrink-1"><div><figure class="image is-128x128 mx-auto mb-2"><img class="avatar" src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202305212017244.png" alt="Studeyang"></figure><p class="title is-size-4 is-block" style="line-height:inherit;">Studeyang</p><p class="is-size-6 is-block">Java开发工程师</p><p class="is-size-6 is-flex justify-content-center"><i class="fas fa-map-marker-alt mr-1"></i><span>China ShenZhen</span></p></div></div></nav><nav class="level is-mobile"><div class="level-item has-text-centered is-marginless"><div><p class="heading">文章</p><a href="/archives"><p class="title">49</p></a></div></div><div class="level-item has-text-centered is-marginless"><div><p class="heading">分类</p><a href="/categories"><p class="title">2</p></a></div></div><div class="level-item has-text-centered is-marginless"><div><p class="heading">标签</p><a href="/tags"><p class="title">20</p></a></div></div></nav><div class="level"><a class="level-item button is-primary is-rounded" href="https://github.com/studeyang" target="_blank" rel="noopener">关注我</a></div><div class="level is-mobile is-multiline"><a class="level-item button is-transparent is-marginless" target="_blank" rel="noopener" title="Github" href="https://github.com/studeyang"><i class="fab fa-github"></i></a><a class="level-item button is-transparent is-marginless" target="_blank" rel="noopener" title="Twitter" href="https://twitter.com/studeyang"><i class="fab fa-twitter"></i></a><a class="level-item button is-transparent is-marginless" target="_blank" rel="noopener" title="RSS" href="/rss2.xml"><i class="fas fa-rss"></i></a></div></div></div><div class="card widget" data-type="categories"><div class="card-content"><div class="menu"><h3 class="menu-label">分类</h3><ul class="menu-list"><li><a class="level is-mobile" href="/categories/technotes/"><span class="level-start"><span class="level-item">technotes</span></span><span class="level-end"><span class="level-item tag">36</span></span></a></li><li><a class="level is-mobile" href="/categories/%E4%BB%8A%E6%97%A5%E7%AE%97%E6%B3%95/"><span class="level-start"><span class="level-item">今日算法</span></span><span class="level-end"><span class="level-item tag">13</span></span></a></li></ul></div></div></div><div class="card widget" data-type="subscribe-email"><div class="card-content"><div class="menu"><h3 class="menu-label">follow.it</h3><form action="https://api.follow.it/subscription-form/UE1KZFRLRFg2YlEzZXBFcUVwMEx5cHVRQkhqUVpxeVhPSnpIb3JKVmliQkh5OWRDOGIrNk1YaC9mWFYrbzN3eGc3bTJjNStvYUZobFpOSlNuS1VmRFRiQWkreGdvak5hNlVucW5jYXZoaE1YWjFJaWdNaUlnRmtMQlRhYjVlSlJ8dk1oYjBvSmZJYkY3YStmSXNZWE5CeXVBUVFMVnJVRXNOdGN4NVVKQWRSZz0=/8" method="post" target="_blank"><div class="field has-addons"><div class="control has-icons-left is-expanded"><input class="input" name="email" type="email" placeholder="Email"><span class="icon is-small is-left"><i class="fas fa-envelope"></i></span></div><div class="control"><input class="button" type="submit" value="订阅"></div></div></form></div></div></div><div class="column-right-shadow is-hidden-widescreen"></div></div><div class="column column-right is-4-tablet is-4-desktop is-3-widescreen is-hidden-touch is-hidden-desktop-only order-3"><div class="card widget" data-type="recent-posts"><div class="card-content"><h3 class="menu-label">最新文章</h3><article class="media"><figure class="media-left"><a class="image" href="/2024/0803.html"><img src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2024/202408022243347.jpeg" alt="【译】Apache Shiro介绍"></a></figure><div class="media-content"><p class="date"><time dateTime="2024-08-03T01:00:00.000Z">2024-08-03</time></p><p class="title"><a href="/2024/0803.html">【译】Apache Shiro介绍</a></p><p class="categories"><a href="/categories/technotes/">technotes</a></p></div></article><article class="media"><figure class="media-left"><a class="image" href="/2024/0725.html"><img src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2024/202407252241818.jpg" alt="MySQL是如何给表加字段的?"></a></figure><div class="media-content"><p class="date"><time dateTime="2024-07-25T14:00:00.000Z">2024-07-25</time></p><p class="title"><a href="/2024/0725.html">MySQL是如何给表加字段的?</a></p><p class="categories"><a href="/categories/technotes/">technotes</a></p></div></article><article class="media"><figure class="media-left"><a class="image" href="/2024/0705.html"><img src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2024/202407052309418.png" alt="MyBatis拦截器在实际项目中的应用"></a></figure><div class="media-content"><p class="date"><time dateTime="2024-07-05T01:00:00.000Z">2024-07-05</time></p><p class="title"><a href="/2024/0705.html">MyBatis拦截器在实际项目中的应用</a></p><p class="categories"><a href="/categories/technotes/">technotes</a></p></div></article><article class="media"><figure class="media-left"><a class="image" href="/2023/1124.html"><img src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/4881406_2724_4.jpg" alt="Kafka 位移提交的正确姿势"></a></figure><div class="media-content"><p class="date"><time dateTime="2023-11-24T01:00:00.000Z">2023-11-24</time></p><p class="title"><a href="/2023/1124.html">Kafka 位移提交的正确姿势</a></p><p class="categories"><a href="/categories/technotes/">technotes</a></p></div></article><article class="media"><figure class="media-left"><a class="image" href="/2023/0912.html"><img src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202309112237318.jpg" alt="Spring Security入门:保护Web应用"></a></figure><div class="media-content"><p class="date"><time dateTime="2023-09-12T01:00:00.000Z">2023-09-12</time></p><p class="title"><a href="/2023/0912.html">Spring Security入门:保护Web应用</a></p><p class="categories"><a href="/categories/technotes/">technotes</a></p></div></article></div></div><div class="card widget" data-type="archives"><div class="card-content"><div class="menu"><h3 class="menu-label">归档</h3><ul class="menu-list"><li><a class="level is-mobile" href="/archives/2024/"><span class="level-start"><span class="level-item">2024</span></span><span class="level-end"><span class="level-item tag">3</span></span></a></li><li><a class="level is-mobile" href="/archives/2023/"><span class="level-start"><span class="level-item">2023</span></span><span class="level-end"><span class="level-item tag">31</span></span></a></li><li><a class="level is-mobile" href="/archives/2022/"><span class="level-start"><span class="level-item">2022</span></span><span class="level-end"><span class="level-item tag">15</span></span></a></li></ul></div></div></div><div class="card widget" data-type="tags"><div class="card-content"><div class="menu"><h3 class="menu-label">标签</h3><div class="field is-grouped is-grouped-multiline"><div class="control"><a class="tags has-addons" href="/tags/DDD/"><span class="tag">DDD</span><span class="tag">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/Git/"><span class="tag">Git</span><span class="tag">2</span></a></div><div class="control"><a class="tags has-addons" href="/tags/HTTP/"><span class="tag">HTTP</span><span class="tag">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/Java%E8%84%9A%E6%89%8B%E6%9E%B6/"><span class="tag">Java脚手架</span><span class="tag">2</span></a></div><div class="control"><a class="tags has-addons" href="/tags/Kafka/"><span class="tag">Kafka</span><span class="tag">2</span></a></div><div class="control"><a class="tags has-addons" href="/tags/LeetCode/"><span class="tag">LeetCode</span><span class="tag">13</span></a></div><div class="control"><a class="tags has-addons" href="/tags/Log4j/"><span class="tag">Log4j</span><span class="tag">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/Maven/"><span class="tag">Maven</span><span class="tag">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/MyBatis/"><span class="tag">MyBatis</span><span class="tag">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/MySQL/"><span class="tag">MySQL</span><span class="tag">7</span></a></div><div class="control"><a class="tags has-addons" href="/tags/Nacos/"><span class="tag">Nacos</span><span class="tag">2</span></a></div><div class="control"><a class="tags has-addons" href="/tags/Redis/"><span class="tag">Redis</span><span class="tag">6</span></a></div><div class="control"><a class="tags has-addons" href="/tags/Shiro/"><span class="tag">Shiro</span><span class="tag">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/Spring-Security/"><span class="tag">Spring Security</span><span class="tag">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/XXL-JOB/"><span class="tag">XXL-JOB</span><span class="tag">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/%E6%9E%B6%E6%9E%84/"><span class="tag">架构</span><span class="tag">3</span></a></div><div class="control"><a class="tags has-addons" href="/tags/%E7%A8%8B%E5%BA%8F%E4%B9%8B%E9%81%93/"><span class="tag">程序之道</span><span class="tag">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/%E7%BC%96%E7%A8%8B/"><span class="tag">编程</span><span class="tag">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/"><span class="tag">计算机基础</span><span class="tag">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/"><span class="tag">设计模式</span><span class="tag">1</span></a></div></div></div></div></div></div></div></div></section><footer class="footer"><div class="container"><div class="level"><div class="level-start"><a class="footer-logo is-block mb-2" href="/"><img src="https://technotes.oss-cn-shenzhen.aliyuncs.com/2023/202306152245106.gif" alt="吾途 - Studeyang.tech" height="28"></a><p class="is-size-7"><span>© 2024 Studeyang</span> Powered by <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a> & <a href="https://github.com/ppoffice/hexo-theme-icarus" target="_blank" rel="noopener">Icarus</a><br><span id="busuanzi_container_site_uv">共<span id="busuanzi_value_site_uv">0</span>个访客</span></p><p class="is-size-7">© 2023</p></div><div class="level-end"><div class="field has-addons"><p class="control"><a class="button is-transparent is-large" target="_blank" rel="noopener" title="Creative Commons" href="https://creativecommons.org/"><i class="fab fa-creative-commons"></i></a></p><p class="control"><a class="button is-transparent is-large" target="_blank" rel="noopener" title="Attribution 4.0 International" href="https://creativecommons.org/licenses/by/4.0/"><i class="fab fa-creative-commons-by"></i></a></p><p class="control"><a class="button is-transparent is-large" target="_blank" rel="noopener" title="Download on GitHub" href="https://github.com/ppoffice/hexo-theme-icarus"><i class="fab fa-github"></i></a></p></div></div></div></div></footer><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/min/moment-with-locales.min.js"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js" defer></script><script>moment.locale("zh-cn");</script><script>var IcarusThemeSettings = {
article: {
highlight: {
clipboard: true,
fold: 'unfolded'
}
}
};</script><script src="/js/column.js"></script><script src="/js/animation.js"></script><a id="back-to-top" title="回到顶端" href="javascript:;"><i class="fas fa-chevron-up"></i></a><script src="/js/back_to_top.js" defer></script><!--!--><!--!--><!--!--><!--!--><script src="https://cdn.jsdelivr.net/npm/[email protected]/build/cookieconsent.min.js" defer></script><script>window.addEventListener("load", () => {
window.cookieconsent.initialise({
type: "info",
theme: "edgeless",
static: false,
position: "bottom-left",
content: {
message: "此网站使用Cookie来改善您的体验。",
dismiss: "知道了!",
allow: "允许使用Cookie",
deny: "拒绝",
link: "了解更多",
policy: "Cookie政策",
href: "https://www.cookiesandyou.com/",
},
palette: {
popup: {
background: "#edeff5",
text: "#838391"
},
button: {
background: "#4b81e8"
},
},
});
});</script><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/lightgallery.min.js" defer></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/jquery.justifiedGallery.min.js" defer></script><script>window.addEventListener("load", () => {
if (typeof $.fn.lightGallery === 'function') {
$('.article').lightGallery({ selector: '.gallery-item' });
}
if (typeof $.fn.justifiedGallery === 'function') {
if ($('.justified-gallery > p > .gallery-item').length) {
$('.justified-gallery > p > .gallery-item').unwrap();
}
$('.justified-gallery').justifiedGallery();
}
});</script><!--!--><!--!--><!--!--><!--!--><!--!--><script src="/js/main.js" defer></script><div class="searchbox"><div class="searchbox-container"><div class="searchbox-header"><div class="searchbox-input-container"><input class="searchbox-input" type="text" placeholder="想要查找什么..."></div><a class="searchbox-close" href="javascript:;">×</a></div><div class="searchbox-body"></div></div></div><script src="/js/insight.js" defer></script><script>document.addEventListener('DOMContentLoaded', function () {
loadInsight({"contentUrl":"/content.json"}, {"hint":"想要查找什么...","untitled":"(无标题)","posts":"文章","pages":"页面","categories":"分类","tags":"标签"});
});</script></body></html>