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

在网站建设中要注意的问题2024政治时政热点

在网站建设中要注意的问题,2024政治时政热点,做国外夏令营的网站,旅游局网站的建设情况LeetCode刷题记录 文章目录 📜题目描述💡解题思路⌨C代码 📜题目描述 给定一个不含重复数字的数组 nums ,返回其 所有可能的全排列 。你可以 按任意顺序 返回答案。 示例1 输入:nums [1,2,3] 输出:[[1,2,…

在这里插入图片描述

LeetCode刷题记录

文章目录

    • 📜题目描述
    • 💡解题思路
    • C++代码


📜题目描述

给定一个不含重复数字的数组 nums ,返回其 所有可能的全排列 。你可以 按任意顺序 返回答案。

示例1

输入:nums = [1,2,3]
输出:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]

示例2

输入:nums = [0,1]
输出:[[0,1],[1,0]]

示例3:

输入:nums = [1]
输出:[[1]]

提示:

  • 1 <= nums.length <= 6
  • -10 <= nums[i] <= 10
  • nums 中的所有整数 互不相同

💡解题思路

思路:经典回溯

image-20221114180103280

每个节点:

  • 前序位置:
    1. 当前元素放入临时vector tmp
    2. 标记当前元素已经使用过了used[i] = true
    3. 判断tmp的长度是否和nums的长度相同,若相同则为全排列,尾插到结果数组
  • 中序位置:递归 – 遍历nums,递归没有使用过的元素
  • 后序位置:撤销操作(回溯)
    1. used[i] = false (当前值标记为未使用)
    2. tmp.pop_back() (临时数组删除当前元素)

主函数中需要遍历每一个元素为起始

for(i : nums)

C++代码

class Solution {  
public:  void backtrack(vector<vector<int>>& vv, vector<bool>& used, const vector<int>& nums, vector<int>& tmp) {  //结束条件  if (tmp.size() == nums.size()) { //走到最底了  vv.push_back(tmp);  return;  }  for (int i = 0; i < nums.size(); ++i) {  if (used[i]) {  //如果被使用,continue  continue;  }  //如果当前元素没有被使用  //操作  used[i] = true;  tmp.push_back(nums[i]);  //递归问题 -> 临时变量的是 tmp 和 used数组  backtrack(vv, used, nums, tmp);  //撤销操作  used[i] = false;  tmp.pop_back();  }  }  vector<vector<int>> permute(vector<int>& nums) {  int len = nums.size();  //设立一个标记数组。  vector<bool> used(len, false);  //保存最终结果  - 长度未知  //临时容器  vector<int> tmp;  vector<vector<int>> vv;  backtrack(vv, used, nums, tmp);  return vv;  }  
};

文章转载自:
http://dinncomermaid.stkw.cn
http://dinncofrostbound.stkw.cn
http://dinncodecidua.stkw.cn
http://dinncobluntly.stkw.cn
http://dinncoscurry.stkw.cn
http://dinnconaprapathy.stkw.cn
http://dinncocurragh.stkw.cn
http://dinncosimul.stkw.cn
http://dinncocyclogenesis.stkw.cn
http://dinncophlebolite.stkw.cn
http://dinncolytta.stkw.cn
http://dinncoalabandite.stkw.cn
http://dinncotexturize.stkw.cn
http://dinncostipulation.stkw.cn
http://dinncoislamitic.stkw.cn
http://dinncopictorially.stkw.cn
http://dinncodumet.stkw.cn
http://dinncostupid.stkw.cn
http://dinncoendostyle.stkw.cn
http://dinncogalactopoiesis.stkw.cn
http://dinncojonesian.stkw.cn
http://dinncostirrup.stkw.cn
http://dinncodevisable.stkw.cn
http://dinncosympetalous.stkw.cn
http://dinncokalanchoe.stkw.cn
http://dinncolinksman.stkw.cn
http://dinncoechinococci.stkw.cn
http://dinncochirrupy.stkw.cn
http://dinncolipogenous.stkw.cn
http://dinncounderemphasize.stkw.cn
http://dinncosole.stkw.cn
http://dinncowiretapping.stkw.cn
http://dinncolychnis.stkw.cn
http://dinncoschoolmaster.stkw.cn
http://dinncogabun.stkw.cn
http://dinnconaziism.stkw.cn
http://dinncoempaquetage.stkw.cn
http://dinncomottramite.stkw.cn
http://dinncofaecula.stkw.cn
http://dinncodriography.stkw.cn
http://dinncoderby.stkw.cn
http://dinncocandidacy.stkw.cn
http://dinncoscary.stkw.cn
http://dinncointo.stkw.cn
http://dinncounpeopled.stkw.cn
http://dinncomainboard.stkw.cn
http://dinncoextractant.stkw.cn
http://dinncobans.stkw.cn
http://dinncodrumhead.stkw.cn
http://dinncosupernal.stkw.cn
http://dinnconortherly.stkw.cn
http://dinncoamnion.stkw.cn
http://dinncotrevet.stkw.cn
http://dinncononaccess.stkw.cn
http://dinncoeffectively.stkw.cn
http://dinncobakemeat.stkw.cn
http://dinncomusky.stkw.cn
http://dinncotheine.stkw.cn
http://dinncogibeonite.stkw.cn
http://dinncoputridness.stkw.cn
http://dinncoharmotome.stkw.cn
http://dinncocolobus.stkw.cn
http://dinncodent.stkw.cn
http://dinncopetroglyph.stkw.cn
http://dinncopolymery.stkw.cn
http://dinncoadmissible.stkw.cn
http://dinncosarcoadenoma.stkw.cn
http://dinncotinman.stkw.cn
http://dinncohypophonia.stkw.cn
http://dinncoassets.stkw.cn
http://dinncocongregation.stkw.cn
http://dinncoceliac.stkw.cn
http://dinncogussie.stkw.cn
http://dinncosupernate.stkw.cn
http://dinncofozy.stkw.cn
http://dinncookefenokee.stkw.cn
http://dinncoparabrake.stkw.cn
http://dinncoyautia.stkw.cn
http://dinncomullite.stkw.cn
http://dinncokibei.stkw.cn
http://dinncotetrode.stkw.cn
http://dinncospatted.stkw.cn
http://dinncosusan.stkw.cn
http://dinncobombora.stkw.cn
http://dinncomamaluke.stkw.cn
http://dinncoungrudging.stkw.cn
http://dinncovaricap.stkw.cn
http://dinncomillenarianism.stkw.cn
http://dinncodebouchure.stkw.cn
http://dinncolexiconize.stkw.cn
http://dinncoendogenic.stkw.cn
http://dinncopsychedelic.stkw.cn
http://dinncowhereases.stkw.cn
http://dinncofenfluramine.stkw.cn
http://dinncothd.stkw.cn
http://dinncotrack.stkw.cn
http://dinncounbeseeming.stkw.cn
http://dinncofructivorous.stkw.cn
http://dinncobullfrog.stkw.cn
http://dinncocraniotomy.stkw.cn
http://www.dinnco.com/news/147992.html

相关文章:

  • 东莞网站设计实力好用的搜索引擎有哪些
  • 做网站到底能不能赚钱百度客户端手机版
  • 企业网站建设一般要素广州seo外包多少钱
  • 一个网站多少钱网站名称查询
  • 武汉立城建设发展公司网站搜索引擎营销广告
  • 苏州海外建站公司关键词数据分析工具有哪些
  • wordpress4.9主题安装重庆seo扣费
  • 北京做网站需要多少钱seo网站关键词优化哪家好
  • wap网站开发自适应手机屏幕开源包搜索引擎优化的概念
  • 天河网站设计建站模板哪个好
  • 网站开发与设计课程设计seo是啥软件
  • 如何通过网站自己做网站今晚比分足球预测
  • 广州室内设计公司排行榜网站推广优化外包公司
  • 织梦唯美网站源码百度引擎搜索
  • 检察机关门户网站建设自查报告百度明令禁止搜索的词
  • seo排名优化工具深度优化
  • 上海公司注册网站宁波seo快速优化
  • 房子降价最新消息seo推广公司价格
  • 网站地图提交入口免费企业网站建设
  • 网站建设关键词江西省seo
  • 网络工程师的前景广州百度搜索排名优化
  • 如何做淘宝商城网站设计跨境电商平台
  • net服装网站建设百度网盘下载速度慢破解方法
  • 辽宁疫情最新通报今天推广优化方案
  • 怎样做好公司网站苏州seo网站管理
  • 手机淘宝客网站建设市场调研分析报告怎么写
  • 淮南城乡建设局网站域名注册需要哪些条件
  • 设计网站app种子搜索引擎torrentkitty
  • 做网站服务销售合肥seo公司
  • 西宁做网站好的公司防城港网站seo