当前位置: 首页 > news >正文

怎么做简单的企业网站seo投放

怎么做简单的企业网站,seo投放,网站建设管理内容保障制度,怎样注册一个网站做电商文章目录 1.买卖股票的最佳时机No.1212.跳跃游戏No.553.跳跃游戏IINo.454.划分字母区间No.763 1.买卖股票的最佳时机No.121 class Solution {public int maxProfit(int[] prices) {if (prices null || prices.length 0) {return 0;}// 初始化买入价格为最大值,最大…

文章目录

        • 1.买卖股票的最佳时机No.121
        • 2.跳跃游戏No.55
        • 3.跳跃游戏IINo.45
        • 4.划分字母区间No.763

1.买卖股票的最佳时机No.121

在这里插入图片描述

class Solution {public int maxProfit(int[] prices) {if (prices == null || prices.length == 0) {return 0;}// 初始化买入价格为最大值,最大利润为 0int minPrice = Integer.MAX_VALUE;int maxProfit = 0;// 遍历价格数组for (int price : prices) {// 更新最低买入价格if (price < minPrice) {minPrice = price;}// 计算当前价格卖出的利润else {maxProfit = Math.max(maxProfit, price - minPrice);}}return maxProfit;}
}
2.跳跃游戏No.55

在这里插入图片描述

class Solution {public boolean canJump(int[] nums) {int maxReach = 0;  // 初始化为 0,表示起始位置能够到达的最远距离// 遍历数组for (int i = 0; i < nums.length; i++) {// 如果当前位置不可达,返回 falseif (i > maxReach) {return false;}// 更新能够到达的最远位置maxReach = Math.max(maxReach, i + nums[i]);// 如果能够到达最后一个位置,返回 trueif (maxReach >= nums.length - 1) {return true;}}return false;  // 遍历结束,若不能到达最后一个位置,则返回 false}
}
public boolean canJump(int[] nums) {if(nums.length==1) return true;int cover = 0;for(int i = 0;i<=cover;i++){cover = Math.max(cover,i+nums[i]);if(cover>=nums.length-1){return true;}}return false;}
3.跳跃游戏IINo.45

在这里插入图片描述

class Solution {public int jump(int[] nums) {int n = nums.length;// 如果数组长度为 1,不需要跳跃if (n == 1) return 0;int jumps = 0;int farthest = 0;int currentEnd = 0;// 遍历到倒数第二个元素即可for (int i = 0; i < n ; i++) {// 更新能到达的最远位置farthest = Math.max(farthest, i + nums[i]);// 如果到达了当前区间的末尾,进行跳跃if (i == currentEnd) {jumps++;currentEnd = farthest;// 如果当前区间的末尾已经能够到达最后一个位置,提前结束if (currentEnd >= n - 1) {break;}}}return jumps;}
}
public int jump(int[] nums) {if(nums.length==1) return 0;int curr = 0;int next = 0;int jump = 0;for(int i = 0;i<nums.length;i++){next = Math.max(next,i+nums[i]);if(i==curr){jump++;curr = next;if(curr>=nums.length-1) break;}}return jump;}
4.划分字母区间No.763

在这里插入图片描述

  • 思路
    • 统计每一个字符最后出现的位置
    • 从头遍历字符,并更新字符的最远出现下标,如果找到字符最远出现位置下标和当前下标相等了,则找到了分割点
class Solution {public List<Integer> partitionLabels(String s) {// Step 1: 记录每个字符最后出现的位置int[] lastIndex = new int[26];  // 因为字符是小写字母,共 26 个for (int i = 0; i < s.length(); i++) {lastIndex[s.charAt(i) - 'a'] = i;  // 更新字符的最后出现位置}List<Integer> result = new ArrayList<>();int currentEnd = 0;  // 当前片段的结束位置int start = 0;  // 当前片段的起始位置// Step 2: 遍历字符串,划分片段for (int i = 0; i < s.length(); i++) {currentEnd = Math.max(currentEnd, lastIndex[s.charAt(i) - 'a']);  // 更新当前片段的结束位置if (i == currentEnd) {  // 如果当前索引达到了当前片段的结束位置result.add(i - start + 1);  // 记录当前片段的长度start = i + 1;  // 更新下一个片段的起始位置}}return result;}
}
http://www.hkea.cn/news/359829/

相关文章:

  • 在外汇局网站做登记报告恢复原来的百度
  • 做外贸做的很好的网站全国疫情突然又严重了
  • 开发app需要什么样的团队百度seo优化培训
  • ftp上传网站之后软文什么意思范例
  • 询广西南宁网站运营推广系统
  • wordpress侧边栏小工具佛山网站优化
  • 用vs做网站原型企业培训课程有哪些内容
  • wordpress评论自定义百度刷排名seo
  • 四川建设网官网登录入口泉州seo外包
  • 网站有备案 去掉备案网络营销意思
  • 新建网站推广给企业百度问一问在线咨询客服
  • 曹鹏wordpress建站seo视频广东疫情防控措施
  • 网站开发的岗位排名优化工具
  • 岳阳做网站怎么做推广让别人主动加我
  • 不断改进网站建设公司百度官网优化
  • 万户网站宁波网站制作优化服务
  • 潍坊快速网站排名网站是怎么做出来的
  • 聚美优品的pc网站建设注册网址
  • 陕西省住房与城乡建设厅网站免费b站推广软件
  • 淮南市住房与城乡建设部网站网店买卖有哪些平台
  • 网页qq表情佛山百度快速排名优化
  • 网站建设方案论文1500社会新闻最新消息
  • 网站组建 需求分析市场监督管理局职责
  • 云课堂哪个网站做的好厦门关键词优化seo
  • 中企动力沈阳分公司seo免费诊断电话
  • 网站vps被黑湖人最新排名最新排名
  • 如何夸奖客户网站做的好seo课程心得体会
  • 有哪些做电子商务的网站时空seo助手
  • 临沂百度网站电脑培训机构哪个好
  • 无锡专业做网站的公司怎样把自己的产品放到网上销售