栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

第八十七天- Spring MVC

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

第八十七天- Spring MVC

今天也主要是一些零碎的笔记,心情也不是很好,现在只求不要出岔子,一切低调而平静。
今日进度:
1.提前起床了,提高了早上的效率
2.不知道是不是因为昨天做噩梦了,今天一整天效率不是很理想,希望明天可以提高效率

学习笔记:
1.DispatcherServlet相当于Spring MVC里的Front Controller

2.DispatcherServlet通过HandlerAdapter来调用Controller

3.HandlerInterceptor是DispatcherServlet与Controller之间的过渡器,HandlerMapping给DispatcherServlet一个具体的controller实例

4.HandlerExecutionChain

5.
ModelAndView:model的具体表现
ViewResolver:根据配置找出需要的视图对象
View:呈现页面
Controller是必须写的,其他的可以选写或者通过配置实现

6.最长公共子序列(LCS)状态转移方程

7.dijkstra单源最短路径算法也是动态规划算法,优化动态规划问题的空间的时候应该考虑是否会让我们重构之前的路径,如果需要的话,就要保存之前的计算值

8.Convert passive voice to active voice because active voice is usually clearer.

    an active voice sentence follows this formula:
    Active Voice Sentence = actor + verb + target
    A passive voice sentence reverses the formula. That is, a passive voice sentence typically follows the following formula:
    Passive Voice Sentence = target + verb + actor

      Active voice provides the following advantages:
      Most readers mentally convert passive voice to active voice. Why subject your readers to extra processing time? By sticking to active voice, readers can skip the preprocessor stage and go straight to compilation.
      Passive voice obfuscates your ideas, turning sentences on their head. Passive voice reports action indirectly.
      Some passive voice sentences omit an actor altogether, which forces the reader to guess the actor’s identity.
      Active voice is generally shorter than passive voice.

      11.376. 摆动序列
      如果连续数字之间的差严格地在正数和负数之间交替,则数字序列称为 摆动序列 。第一个差(如果存在的话)可能是正数或负数。仅有一个元素或者含两个不等元素的序列也视作摆动序列。
      例如, [1, 7, 4, 9, 2, 5] 是一个 摆动序列 ,因为差值 (6, -3, 5, -7, 3) 是正负交替出现的。
      相反,[1, 4, 7, 2, 5] 和 [1, 7, 4, 5, 5] 不是摆动序列,第一个序列是因为它的前两个差值都是正数,第二个序列是因为它的最后一个差值为零。
      子序列 可以通过从原始序列中删除一些(也可以不删除)元素来获得,剩下的元素保持其原始顺序。
      给你一个整数数组 nums ,返回 nums 中作为 摆动序列 的 最长子序列的长度 。

      输入:nums = [1,7,4,9,2,5]
      输出:6
      解释:整个序列均为摆动序列,各元素之间的差值为 (6, -3, 5, -7, 3) 。

      解题思路:使用两个数组up和down来分别表示最后一个数是向上的最长摆动子序列和最后一个数是向下的最长子序列。遍历数组,更新两个数组,以up数组为例,up[i-1]的最后一个元素为nums[j],如果当前元素nums[i]<=nums[i-1]则up[i]=up[i-1],不用更新;如果nums[i]>nums[i-1],当nums[i-1]=nums[j]时,直接在后面加上nums[i],两种情况下都可以有,up[i]=down[i-1]+1。同理,对于down数组,当nums[i]>=nums[i-1]时,down[i]=down[i-1],当nums[i]

      class Solution {
          public int wiggleMaxLength(int[] nums) {
              int n = nums.length;
                  if(n<2){
                  return n;
              }
              int up[] = new int[n];
              int down[] = new int[n];
              up[0] = 1;
              down[0] = 1;
              for(int i=1; inums[i-1]){
                      down[i] = down[i-1];
                      up[i] = Math.max(down[i-1]+1, up[i-1]);
                  }
                  else if(nums[i]==nums[i-1]){
                      down[i] = down[i-1];
                      up[i] = up[i-1];
                  }
              }
              return Math.max(up[n-1], down[n-1]);
          }
      }
      

      今天早点休息,明天早起继续加油!

      转载请注明:文章转载自 www.mshxw.com
      本文地址:https://www.mshxw.com/it/778286.html
      我们一直用心在做
      关于我们 文章归档 网站地图 联系我们

      版权所有 (c)2021-2022 MSHXW.COM

      ICP备案号:晋ICP备2021003244-6号