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

白山建设局网站wordpress id开发者

白山建设局网站,wordpress id开发者,专门做吃播的网站,门户网站建设存在的问题和差距文章目录 491.递增子序列46.全排列47.全排列II 491.递增子序列 文字讲解#xff1a;递增子序列 视频讲解#xff1a;递增子序列 **状态#xff1a;这题看了文字讲解才AC#xff0c;掌握了如何在回溯里通过Set集合来对同层节点去重 思路#xff1a; 代码#xff1a; cla… 文章目录 491.递增子序列46.全排列47.全排列II 491.递增子序列 文字讲解递增子序列 视频讲解递增子序列 **状态这题看了文字讲解才AC掌握了如何在回溯里通过Set集合来对同层节点去重 思路 代码 class Solution {ListListInteger result new ArrayList();LinkedListInteger tempList new LinkedList();public ListListInteger findSubsequences(int[] nums) {backTracking(nums, 0);return result;}//本题的关键在于同层不能有重复元素当前层的节点不能大于上一层的值public void backTracking(int[] nums, int startIndex) {if (startIndexnums.length) {return;}//借助set集合去重HashSet hs new HashSet();for (int i startIndex; i nums.length; i) {if ((!tempList.isEmpty() tempList.get(tempList.size()-1) nums[i]) || hs.contains(nums[i])) {continue;}hs.add(nums[i]);tempList.offer(nums[i]);if (tempList.size()1) {result.add(new ArrayList(tempList));}backTracking(nums, i1);tempList.pollLast();}} }46.全排列 文字讲解全排列 视频讲解全排列 状态做完组合类的题这题好简单 思路 代码 class Solution {ListListInteger result new ArrayList();LinkedListInteger tempList new LinkedList();boolean[] usedArr;public ListListInteger permute(int[] nums) {this.usedArr new boolean[nums.length];for (int i 0; i this.usedArr.length; i) {this.usedArr[i] false;}backTracking(nums);return result;}public void backTracking(int[] nums) {if (tempList.size()nums.length) {//收集result.add(new ArrayList(tempList));return;}for (int i 0; i nums.length; i) {if (usedArr[i]) {continue;}usedArr[i]true;tempList.offer(nums[i]);backTracking(nums);tempList.pollLast();usedArr[i]false;}} }47.全排列II 文字讲解全排列II 视频讲解全排列 状态将前两题的思路整合这题ok 思路 代码 class Solution {ListListInteger result new ArrayList();LinkedListInteger tempList new LinkedList();boolean[] used;public ListListInteger permuteUnique(int[] nums) {Arrays.sort(nums);this.used new boolean[nums.length];for (int i 0; i used.length; i) {used[i] false;}backTracking(nums);return result;}public void backTracking(int[] nums) {if (tempList.size()nums.length) {result.add(new ArrayList(tempList));return;}HashSetInteger hs new HashSet();for (int i 0; i nums.length; i) {if (used[i] || hs.contains(nums[i])) {continue;}hs.add(nums[i]);used[i] true;tempList.offer(nums[i]);backTracking(nums);tempList.pollLast();used[i] false;}} }
http://www.zqtcl.cn/news/300652/

相关文章:

  • 4线城市搞网站开发丹灶网站建设公司
  • 青岛网站建设seo优化wordpress分类标题自定义
  • 网站开发本地环境在海南注册公司需要多少钱
  • 济南网站开发去哪儿旅行app下载安装
  • 大城 网站北京做网站男生工资
  • 赣州网站建设百家号免费软件网
  • 在合肥做网站多少钱网站开发外包平台
  • 百度指数查询平台网站建设SEO优化哪家好
  • 网站怎么在成都备案中企动力如何
  • 免费数据统计网站app推广拉新一手渠道
  • 网站推广效果不好原因zac seo博客
  • 高端网站设计合肥网站建设个人网站建设公
  • 廊坊建站模板系统做效果图的网站
  • 建网站打开需要验证四川省成都市建设厅官网
  • 网站文章列表如何排版珠海建设工程信息网站
  • 郑州个人做网站建设银行招聘网站
  • 杭州网站设计公司联系亿企邦网站怎么上百度
  • 网站建设的未来网站不备案访问
  • 网站改版效果图怎么做网站建设的五个基本要素
  • 河南建站网站做o2o网站需要多少钱
  • 重庆企业网站定制开发公司wordpress用户页
  • 电子商务网站seo网站规划与设计方向
  • 外贸双语网站源码wordpress 柚子
  • 隆昌市住房和城乡建设厅网站html5网页成品代码
  • 泉州丰泽建设局网站wordpress设置logo和公司名
  • 网页与网站设计实验总结网上商城互联网网站开发
  • 学院宣传网站建设简介郑州加盟网站建设
  • 上海网站建设sheji021wordpress ssl 图片
  • 网站管理人员队伍建设说明材料搞笑网站建设目的和意义
  • 网站建设应该考虑哪些问题如何规划网站栏目