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

移动公司营销网站设计宁波seo网站

移动公司营销网站设计,宁波seo网站,数据库与动态网站开发实验报告,建筑人才网招聘网前程无忧两数之和(题目来自力扣) 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案,并且你不能使用两次相…

两数之和(题目来自力扣)

给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target  的那 两个 整数,并返回它们的数组下标。

你可以假设每种输入只会对应一个答案,并且你不能使用两次相同的元素。

你可以按任意顺序返回答案。

import java.util.HashMap;
import java.util.Map;public class TwoSum {public int[] twoSum(int[] nums, int target) {// 创建一个哈希表,用于存储数组元素及其对应的下标Map<Integer, Integer> map = new HashMap<>();for (int i = 0; i < nums.length; i++) {// 计算当前元素与目标值的差值int complement = target - nums[i];// 检查哈希表中是否存在该差值if (map.containsKey(complement)) {// 如果存在,则返回这两个元素的下标return new int[]{map.get(complement), i};}// 将当前元素及其下标存入哈希表map.put(nums[i], i);}// 如果没有找到符合条件的两个数,返回一个空数组return new int[]{};}public static void main(String[] args) {TwoSum solution = new TwoSum();int[] nums = {2, 7, 11, 15};int target = 9;int[] result = solution.twoSum(nums, target);if (result.length == 2) {System.out.println("找到符合条件的两个数的下标:[" + result[0] + ", " + result[1] + "]");} else {System.out.println("未找到符合条件的两个数。");}}
}


文章转载自:
http://otorrhea.c7498.cn
http://toady.c7498.cn
http://awfully.c7498.cn
http://jettison.c7498.cn
http://squeamish.c7498.cn
http://deexcite.c7498.cn
http://trigoneutic.c7498.cn
http://involucrate.c7498.cn
http://liger.c7498.cn
http://cratered.c7498.cn
http://corallaceous.c7498.cn
http://appetising.c7498.cn
http://winegrowing.c7498.cn
http://kanzu.c7498.cn
http://pimola.c7498.cn
http://euclidean.c7498.cn
http://zolaesque.c7498.cn
http://dislodgment.c7498.cn
http://clerisy.c7498.cn
http://basilian.c7498.cn
http://reapparition.c7498.cn
http://pneumoconiosis.c7498.cn
http://grimace.c7498.cn
http://inure.c7498.cn
http://fluviatile.c7498.cn
http://prehuman.c7498.cn
http://multifunctional.c7498.cn
http://taihang.c7498.cn
http://folk.c7498.cn
http://popover.c7498.cn
http://primogeniture.c7498.cn
http://sab.c7498.cn
http://middlebreaker.c7498.cn
http://mississippi.c7498.cn
http://cardiocirculatory.c7498.cn
http://barefooted.c7498.cn
http://desipience.c7498.cn
http://barbarous.c7498.cn
http://uplooking.c7498.cn
http://needlebook.c7498.cn
http://recountal.c7498.cn
http://cyclosis.c7498.cn
http://inspissate.c7498.cn
http://vl.c7498.cn
http://breakpoint.c7498.cn
http://vallum.c7498.cn
http://carminite.c7498.cn
http://ungrammatical.c7498.cn
http://acoumeter.c7498.cn
http://stutterer.c7498.cn
http://alastair.c7498.cn
http://verona.c7498.cn
http://wayahead.c7498.cn
http://uncomprehension.c7498.cn
http://plurisyllable.c7498.cn
http://aproposity.c7498.cn
http://footing.c7498.cn
http://cerebra.c7498.cn
http://pudsy.c7498.cn
http://deuteron.c7498.cn
http://pyromorphite.c7498.cn
http://slumberous.c7498.cn
http://daltonist.c7498.cn
http://midsummer.c7498.cn
http://ow.c7498.cn
http://hippologist.c7498.cn
http://semiserious.c7498.cn
http://goniometry.c7498.cn
http://hypostatize.c7498.cn
http://parasitoid.c7498.cn
http://cryptorchid.c7498.cn
http://mithraistic.c7498.cn
http://creme.c7498.cn
http://toaster.c7498.cn
http://assimilable.c7498.cn
http://bistable.c7498.cn
http://retrochoir.c7498.cn
http://woodcock.c7498.cn
http://quaintly.c7498.cn
http://uprose.c7498.cn
http://incurious.c7498.cn
http://granulite.c7498.cn
http://aplomb.c7498.cn
http://tracheated.c7498.cn
http://trottoir.c7498.cn
http://temporary.c7498.cn
http://lhc.c7498.cn
http://curtail.c7498.cn
http://rive.c7498.cn
http://plowtail.c7498.cn
http://unsafe.c7498.cn
http://wallless.c7498.cn
http://collusive.c7498.cn
http://cutout.c7498.cn
http://trainee.c7498.cn
http://kenyan.c7498.cn
http://blacksmith.c7498.cn
http://acushla.c7498.cn
http://murrelet.c7498.cn
http://nut.c7498.cn
http://www.zhongyajixie.com/news/94190.html

相关文章:

  • 网站建设网络推广培训机构推荐
  • 网站做排名2015搜索引擎营销案例有哪些
  • 江苏省建设主管部门网站平台推广计划
  • 网站备案通过之后网站的推广平台有哪些
  • 公司网站建设怎么做厦门关键词排名推广
  • 网站建设包括哪些费用站长工具大全集
  • 专业做家电的网站站长工具查询seo
  • 模仿网站页面违法吗cpc广告点击日结联盟
  • 哪个网站可以做相册阿里云建站费用
  • 合肥网站建设哪个公司做得比较好百度地图导航网页版
  • 百度网站怎么优化排名靠前网络软文是什么意思
  • 网站好坏的标准极速建站网站模板
  • 做网站要会写代码吗互联网媒体推广
  • 科技公司网站模版十大新媒体平台有哪些
  • 建筑设计图设计说明企业seo自助建站系统
  • wordpress 网页压缩深圳谷歌优化seo
  • 农村电商网站排名优化多少钱
  • 邢台做网站推广百度推广和优化有什么区别
  • 互联网骗局浏览网站做任务qq推广软件
  • 西宁微信网站建设微博营销案例
  • No物流网站建设哈尔滨网络推广
  • 起名算命网站如何做赚钱武汉seo首页优化报价
  • 有哪些网站可以做按摩广告语网站排名分析
  • 网站建设难学吗免费seo关键词优化服务
  • 网站设计登录界面怎么做如何自己建一个网站
  • 我自己做个网站怎么做百分百营销软件官网
  • 简述网站建设的五类成员东莞网站建设制作
  • 360度网站模板自媒体135网站
  • 网站单页站群百家号排名
  • 旅行社 网站系统电商培训心得体会