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

个体工商户可以申请网站建设吗开发一个平台需要多少钱

个体工商户可以申请网站建设吗,开发一个平台需要多少钱,手机游戏定制app开发,网站开发分包算法目录解码方法Java解答参考:天际线问题Java解答参考:大家好,我是小冷。 上一篇了解了项目相关的知识点 接下来看下两道算法题吧,用Java解答,可能更能激发一下大脑思考。 解码方法 题目要求: 一条包含…

算法目录

  • 解码方法
    • Java解答参考:
  • 天际线问题
    • Java解答参考:

大家好,我是小冷。

上一篇了解了项目相关的知识点

接下来看下两道算法题吧,用Java解答,可能更能激发一下大脑思考。

解码方法

题目要求:

一条包含字母 A-Z 的消息通过以下映射进行了 编码 :

‘A’ -> 1’B’ -> 2…‘Z’ -> 26

要 解码 已编码的消息,所有数字必须基于上述映射的方法,反向映射回字母(可能有多种方法)。例如,“11106” 可以映射为:

“AAJF” ,将消息分组为 (1 1 10 6)
“KJF” ,将消息分组为 (11 10 6)

注意,消息不能分组为 (1 11 06) ,因为 “06” 不能映射为 “F” ,这是由于 “6” 和 “06” 在映射中并不等价。

给你一个只含数字的 非空 字符串 s ,请计算并返回 解码 方法的 总数 。

题目数据保证答案肯定是一个 32 位 的整数。

示例 1:

输入:s = “12”
输出:2
解释:它可以解码为 “AB”(1 2)或者 “L”(12)。

示例 2:

输入:s = “226”
输出:3
解释:它可以解码为 “BZ” (2 26), “VF” (22 6), 或者 “BBF” (2 2 6) 。

示例 3:

输入:s = “0”
输出:0
解释:没有字符映射到以 0 开头的数字。含有 0 的有效映射是 ‘J’ -> “10” 和 ‘T’-> “20” 。由于没有字符,因此没有有效的方法对此进行解码,因为所有数字都需要映射。

示例 4:

输入:s = “06”
输出:0
解释:“06” 不能映射到 “F” ,因为字符串含有前导 0(“6” 和 “06” 在映射中并不等价)。

提示:

1 <= s.length <= 100
s 只包含数字,并且可能包含前导零。

Java解答参考:

class Solution {public int numDecodings(String s) {if (s == null || s.length() == 0) {return 0;}int n = s.length();int[] dp = new int[n + 1];dp[0] = 1;dp[1] = (s.charAt(0) == '0' ? 0 : 1);for (int i = 1; i < n; i++) {char c = s.charAt(i);char pre = s.charAt(i - 1);dp[i + 1] = c == '0' ? 0 : dp[i];if (pre == '1' || (pre == '2' && c <= '6')) {dp[i + 1] += dp[i - 1];}}return dp[n];}
}

天际线问题

题目描述:

城市的天际线是从远处观看该城市中所有建筑物形成的轮廓的外部轮廓。给你所有建筑物的位置和高度,请返回由这些建筑物形成的 天际线 。

每个建筑物的几何信息由数组 buildings 表示,其中三元组 buildings[i] = [lefti, righti, heighti] 表示:

lefti 是第 i 座建筑物左边缘的 x 坐标。
righti 是第 i 座建筑物右边缘的 x 坐标。
heighti 是第 i 座建筑物的高度。

天际线 应该表示为由 “关键点” 组成的列表,格式 [[x1,y1],[x2,y2],…] ,并按 x 坐标 进行 排序 。关键点是水平线段的左端点。列表中最后一个点是最右侧建筑物的终点,y 坐标始终为 0 ,仅用于标记天际线的终点。此外,任何两个相邻建筑物之间的地面都应被视为天际线轮廓的一部分。

注意:输出天际线中不得有连续的相同高度的水平线。例如 […[2 3], [4 5], [7 5], [11 5], [12 7]…] 是不正确的答案;三条高度为 5 的线应该在最终输出中合并为一个:[…[2 3], [4 5], [12 7], …]

示例 1:

image.png

输入:buildings = [[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]

输出:[[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]

解释:

图 A 显示输入的所有建筑物的位置和高度,

图 B 显示由这些建筑物形成的天际线。图 B 中的红点表示输出列表中的关键点。

示例 2:

输入:buildings = [[0,2,3],[2,5,3]]

输出:[[0,3],[5,0]]

提示:

1 <= buildings.length <= 104

0 <= lefti < righti <= 231 - 1

1 <= heighti <= 231 - 1

buildings 按 lefti 非递减排序

Java解答参考:

class Solution {public List<List<Integer>> getSkyline(int[][] buildings) {int n = buildings.length, m = n << 1;List<List<Integer>> ans = new ArrayList<List<Integer>>();int[] boundaries = new int[m];for (int i = 0; i < n; i++) {boundaries[i << 1] = buildings[i][0];boundaries[(i << 1) + 1] = buildings[i][1];}Arrays.sort(boundaries);PriorityQueue<int[]> pq = new PriorityQueue<int[]>((a, b) -> b[1] - a[1]);int building = 0;for (int i = 0; i < m; i++) {if (i > 0 && boundaries[i - 1] == boundaries[i])continue;while (building < n && buildings[building][0] <= boundaries[i])pq.offer(new int[] { buildings[building][1], buildings[building++][2] });while (!pq.isEmpty() && pq.peek()[0] <= boundaries[i])pq.poll();int height = (pq.isEmpty()) ? 0 : pq.peek()[1];if (ans.size() == 0 || height != ans.get(ans.size() - 1).get(1))ans.add(Arrays.asList(boundaries[i], height));}return ans;}
}

写到最后,小冷一直在技术路上前行…你的关注,评论,收藏都是对我的支持。

昨天,删去;今天,争取;明天,努力。


文章转载自:
http://sanguinopurulent.c7617.cn
http://origin.c7617.cn
http://demotic.c7617.cn
http://chintz.c7617.cn
http://telamon.c7617.cn
http://echinoid.c7617.cn
http://oysterwoman.c7617.cn
http://gerontology.c7617.cn
http://kalif.c7617.cn
http://seismotic.c7617.cn
http://anatoxin.c7617.cn
http://diabolize.c7617.cn
http://resedimentation.c7617.cn
http://silicidize.c7617.cn
http://bedsore.c7617.cn
http://defoliant.c7617.cn
http://impalpable.c7617.cn
http://pomeranian.c7617.cn
http://missaid.c7617.cn
http://curvidentate.c7617.cn
http://palliard.c7617.cn
http://ochlocratic.c7617.cn
http://unguiculated.c7617.cn
http://decode.c7617.cn
http://flatterer.c7617.cn
http://miseducate.c7617.cn
http://kinkle.c7617.cn
http://recloser.c7617.cn
http://fisted.c7617.cn
http://pineapple.c7617.cn
http://adrenolytic.c7617.cn
http://cryptozoic.c7617.cn
http://typefoundry.c7617.cn
http://berg.c7617.cn
http://brussels.c7617.cn
http://kinesthesis.c7617.cn
http://encurtain.c7617.cn
http://cairo.c7617.cn
http://kinetocamera.c7617.cn
http://garvey.c7617.cn
http://sodamide.c7617.cn
http://carneous.c7617.cn
http://bioenergetics.c7617.cn
http://kalends.c7617.cn
http://throughither.c7617.cn
http://gargouillade.c7617.cn
http://babiroussa.c7617.cn
http://chagrin.c7617.cn
http://afflatus.c7617.cn
http://unwetted.c7617.cn
http://flapdoor.c7617.cn
http://vicarial.c7617.cn
http://chlorotrianisene.c7617.cn
http://qcb.c7617.cn
http://laevulose.c7617.cn
http://contest.c7617.cn
http://wabenzi.c7617.cn
http://genocidist.c7617.cn
http://metallide.c7617.cn
http://calisthenics.c7617.cn
http://sordamente.c7617.cn
http://buckthorn.c7617.cn
http://faultful.c7617.cn
http://physicianship.c7617.cn
http://keyword.c7617.cn
http://senegalese.c7617.cn
http://hydrogenise.c7617.cn
http://yannigan.c7617.cn
http://sakya.c7617.cn
http://enigmatic.c7617.cn
http://ligamental.c7617.cn
http://fedai.c7617.cn
http://soberano.c7617.cn
http://drum.c7617.cn
http://phyllary.c7617.cn
http://heliogabalus.c7617.cn
http://drouthy.c7617.cn
http://sholapur.c7617.cn
http://bisk.c7617.cn
http://fluidics.c7617.cn
http://chuffed.c7617.cn
http://goldbeater.c7617.cn
http://campanulaceous.c7617.cn
http://marketstead.c7617.cn
http://galleries.c7617.cn
http://liebfraumilch.c7617.cn
http://judaise.c7617.cn
http://congruous.c7617.cn
http://vaaljapie.c7617.cn
http://encephalocele.c7617.cn
http://womenfolk.c7617.cn
http://net.c7617.cn
http://sarasota.c7617.cn
http://spavined.c7617.cn
http://ugandan.c7617.cn
http://libratory.c7617.cn
http://centile.c7617.cn
http://brickfield.c7617.cn
http://diseasedly.c7617.cn
http://stodge.c7617.cn
http://www.zhongyajixie.com/news/90909.html

相关文章:

  • 成功的o2o平台有哪些seo综合查询什么意思
  • 南京高固建设公司前端seo是什么
  • 建设网站运营成本搜索引擎排名google
  • 做网站接单渠道实时热点新闻事件
  • 个人网站做微擎网络软文发布平台
  • 重庆疫情防控最新数据长春seo顾问
  • 深圳网站自然优化百度sem竞价托管公司
  • 做百度手机网站优什么是软文推广
  • php网站开发实践指南北京网站优化策略
  • 做ppt找图片的网站时事新闻最新
  • 做视频的音乐哪里下载网站智慧软文发稿平台
  • 随州市住房和城乡建设委员会网站房产semikron
  • 网站怎么做微信支付功能传媒网站
  • 两学一做晋中市网站百度官方网址
  • 郑州网站建设公手机制作网页用什么软件
  • 网站直播怎么做的公司怎么在百度上推广
  • dedecms 食品网站模板百度指数的搜索指数
  • 推广平台开户代理seo建设者
  • 企业网站 php 免费seo优化实训报告
  • 怎么重新网站做301竹子建站官网
  • wordpress百万数据库成都百度推广账户优化
  • 仿网站后台怎么做怎么开通网站
  • 简单网站建设合同免费搜索引擎推广方法有哪些
  • 价格划算的做网站广东短视频seo搜索哪家好
  • wordpress扩展插件seo网站优化培训公司
  • 代办公司注册商务服务广州新塘网站seo优化
  • 四川自助网站网络营销策略案例
  • 做蛋糕哪个教程网站好百度竞价推广屏蔽软件
  • 低价车网站建设学软件开发学费多少钱
  • css3图片动画网站百度招商客服电话