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

如何用腾讯云主机做网站衡水做wap网站的公司

如何用腾讯云主机做网站,衡水做wap网站的公司,直播app开发公司有哪些,html5移动端网站建设⭐️个人主页:小羊 ⭐️所属专栏:LeetCode 热题 100 很荣幸您能阅读我的文章,诚请评论指点,欢迎欢迎 ~ 目录 全排列子集电话号码的字母组合组合总和括号生成单词搜索分割回文串N 皇后 全排列 全排列 class Solution {vector&l…
头像
⭐️个人主页:@小羊
⭐️所属专栏:LeetCode 热题 100
很荣幸您能阅读我的文章,诚请评论指点,欢迎欢迎 ~

动图描述

目录

    • 全排列
    • 子集
    • 电话号码的字母组合
    • 组合总和
    • 括号生成
    • 单词搜索
    • 分割回文串
    • N 皇后


全排列

  • 全排列

在这里插入图片描述

class Solution {vector<vector<int>> res;vector<int> path;bool used[7] = {};int n;
public:vector<vector<int>> permute(vector<int>& nums) {n = nums.size();dfs(nums);return res;}void dfs(vector<int>& nums){if (path.size() == n){res.push_back(path);return;}for (int i = 0; i < n; i++){if (!used[i]){used[i] = true;path.push_back(nums[i]);dfs(nums);used[i] = false;path.pop_back();}}}
};

子集

  • 子集

在这里插入图片描述

class Solution {vector<vector<int>> res;vector<int> path;bool used[11] = {};int n;
public:vector<vector<int>> subsets(vector<int>& nums) {n = nums.size();dfs(nums, 0);return res;}void dfs(vector<int>& nums, int pos){res.push_back(path);for (int i = pos; i < n; i++){if (!used[i]){used[i] = true;path.push_back(nums[i]);dfs(nums, i + 1);used[i] = false;path.pop_back();}}}
};

电话号码的字母组合

  • 电话号码的字母组合

在这里插入图片描述

class Solution {string hash[10] = {"", "", "abc", "def","ghi","jkl","mno","pqrs","tuv","wxyz"};vector<string> res;string path;
public:vector<string> letterCombinations(string digits) {if (digits.empty()) return res;dfs(digits, 0);return res;}void dfs(string& digits, int pos){if (pos == digits.size()){res.push_back(path);return;}for (auto e : hash[digits[pos] - '0']){path += e;dfs(digits, pos + 1);path.pop_back();}}
};

组合总和

  • 组合总和

在这里插入图片描述

class Solution {vector<vector<int>> res;vector<int> path;int t;
public:vector<vector<int>> combinationSum(vector<int>& candidates, int target) {t = target;dfs(candidates, 0, 0);return res;}void dfs(vector<int>& candidates, int pos, int sum){if (sum == t){res.push_back(path);return;}else if (sum > t) return;for (int i = pos; i < candidates.size(); i++){path.push_back(candidates[i]);dfs(candidates, i, sum + candidates[i]);path.pop_back();}}
};

括号生成

  • 括号生成

在这里插入图片描述

class Solution {vector<string> res;string path;int left, right, m;
public:vector<string> generateParenthesis(int n) {m = n;dfs();return res;}void dfs(){if (right == m){res.push_back(path);return;}if (left < m){path += "(";left++;dfs();path.pop_back();left--;}if (right < left){path += ")";right++;dfs();path.pop_back();right--;}}
};

单词搜索

  • 单词搜索

在这里插入图片描述

class Solution {int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};bool used[7][7] = {};int m, n;
public:bool exist(vector<vector<char>>& board, string word) {m = board.size(), n = board[0].size();for (int i = 0; i < m; i++){for (int j = 0; j < n; j++){if (board[i][j] == word[0]){if (dfs(board, word, i, j, 1)) return true;}}}return false;}bool dfs(vector<vector<char>>& board, string& word, int i, int j, int pos){if (pos == word.size()) return true;used[i][j] = true;for (int k = 0; k < 4; k++){int x = i + dx[k], y = j + dy[k];if (x >= 0 && x < m && y >= 0 && y < n && !used[x][y] && board[x][y] == word[pos]){if (dfs(board, word, x, y, pos + 1)) return true;}}used[i][j] = false;return false;}
};

分割回文串

  • 分割回文串

在这里插入图片描述

class Solution {vector<vector<string>> res;vector<string> path;
public:vector<vector<string>> partition(string s) {dfs(s, 0);return res;}void dfs(string& s, int pos){if (pos == s.size()){res.push_back(path);return;}for (int i = pos; i < s.size(); i++){if (check(s, pos, i)){path.push_back(s.substr(pos, i - pos + 1));dfs(s, i + 1);path.pop_back();}}}bool check(string& s, int l, int r){while (l < r && s[l] == s[r]){l++, r--;}return l >= r;} 
};

N 皇后

  • N 皇后

在这里插入图片描述

class Solution {vector<vector<string>> res;vector<string> path;bool checkcol[10], checkdig1[20], checkdig2[20];int m;
public:vector<vector<string>> solveNQueens(int n) {m = n;path.resize(n);for (int i = 0; i < n; i++) path[i].append(n, '.');dfs(0);return res;}void dfs(int row){if (row == m){res.push_back(path);return;}for (int col = 0; col < m; col++) // 尝试在当前行放Q{if (!checkcol[col] && !checkdig1[col - row + m] && !checkdig2[col + row]){checkcol[col] = checkdig1[col - row + m] = checkdig2[col + row] = true;path[row][col] = 'Q';dfs(row + 1);checkcol[col] = checkdig1[col - row + m] = checkdig2[col + row] = false;path[row][col] = '.';}}}
};

本篇文章的分享就到这里了,如果您觉得在本文有所收获,还请留下您的三连支持哦~

头像

文章转载自:

http://mo5xDR9V.zbqry.cn
http://KCoQtqv2.zbqry.cn
http://NsuedDMU.zbqry.cn
http://hMwfaZSG.zbqry.cn
http://9XukGYla.zbqry.cn
http://JgvcdlPM.zbqry.cn
http://ywQaVnhZ.zbqry.cn
http://QZuSf9CT.zbqry.cn
http://MeMfUbbb.zbqry.cn
http://5VcjwBHJ.zbqry.cn
http://t1rY29IP.zbqry.cn
http://i1rVyfhK.zbqry.cn
http://BjkmcA85.zbqry.cn
http://Np9asRSO.zbqry.cn
http://f1c2a3vi.zbqry.cn
http://TYX13tQt.zbqry.cn
http://fwlUL0mU.zbqry.cn
http://iQgKK0iw.zbqry.cn
http://ZdEfzoid.zbqry.cn
http://aZXtlMfo.zbqry.cn
http://3ugqnbD3.zbqry.cn
http://JAnMcyJM.zbqry.cn
http://T2icy368.zbqry.cn
http://PdTO6hlE.zbqry.cn
http://zMxBiHbP.zbqry.cn
http://pMvbx8Pw.zbqry.cn
http://gbtllthH.zbqry.cn
http://6Ii7Qgw0.zbqry.cn
http://zicV2w85.zbqry.cn
http://N1hCL2B9.zbqry.cn
http://www.dtcms.com/wzjs/718530.html

相关文章:

  • 一个完美的网站怎么做网站建设 问卷调查
  • 网站开发费用多少莱芜可信赖的网站建设
  • 汕头选择免费网站优化如何做网站网站
  • 网站的产品图片怎样做清晰营销网站建设合同
  • 深圳哪些公司需要做网站深圳市罗湖区住房和建设局官网
  • 做美食的网站哪个好黄冈便宜的网站推广怎么做
  • 宁波 外贸网站建设做平面设计都关注哪些网站
  • 四川广安网站建设如何设计制作一般的企业网站
  • 网站案例展示网络推广网站大全
  • 规划网站开发总体方案外贸免费p2p网站建设
  • 海南彩票网站开发百度站长工具网站提交
  • asp新闻发布网站模板下载网络架构是什么
  • 网站设计公司哪里好wordpress 不同数据库
  • 郑州定制网站开发在线设计平台行业的发展趋势
  • 网站搭建需要什么国外html响应式网站模板
  • 网站登录界面html安顺高端网站建设平台
  • 专业自适应网站建设极速建站网络营销推广公司网站有哪些
  • 网站后台模板永康市网站建设
  • 集宁网站建设SEO优化网站设置地图
  • 北海哪里做网站建设汕头seo优化培训
  • 天津市工程建设交易网站查汗国山东省建设管理中心网站首页
  • 租车公司网站模板做书封面的网站
  • 网站好坏wordpress lensnews
  • 宁波哪家公司做网站好网站建设优劣势分析
  • 广州旅游团购网站建设靖江网站
  • 中山外贸出口网站建设多少钱哪里有怎么注册公司名字和商标
  • wamp搭建多个网站wordpress去除作者信息
  • 电子政务网站建设公司排行榜wordpress下载站
  • 123建站vps搭建wordpress博客
  • 东莞清洁服务网站建设seo课程