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

app开发做网站wordpress增加模板

app开发做网站,wordpress增加模板,安居客网站应该如何做,360建筑网怎么重新注册文章目录1. 题目2. 解题2.1 回溯2.2 位运算1. 题目 请你设计一个迭代器类#xff0c;包括以下内容#xff1a; 一个构造函数#xff0c;输入参数包括#xff1a;一个 有序且字符唯一 的字符串 characters#xff08;该字符串只包含小写英文字母#xff09;和一个数字 c… 文章目录1. 题目2. 解题2.1 回溯2.2 位运算1. 题目 请你设计一个迭代器类包括以下内容 一个构造函数输入参数包括一个 有序且字符唯一 的字符串 characters该字符串只包含小写英文字母和一个数字 combinationLength 。函数 next() 按 字典序 返回长度为 combinationLength 的下一个字母组合。函数 hasNext() 只有存在长度为 combinationLength 的下一个字母组合时才返回 True否则返回 False。 示例 CombinationIterator iterator new CombinationIterator(abc, 2); // 创建迭代器 iteratoriterator.next(); // 返回 ab iterator.hasNext(); // 返回 true iterator.next(); // 返回 ac iterator.hasNext(); // 返回 true iterator.next(); // 返回 bc iterator.hasNext(); // 返回 false提示 1 combinationLength characters.length 15 每组测试数据最多包含 10^4 次函数调用。 题目保证每次调用函数 next 时都存在下一个字母组合。来源力扣LeetCode 链接https://leetcode-cn.com/problems/iterator-for-combination 著作权归领扣网络所有。商业转载请联系官方授权非商业转载请注明出处。 2. 解题 2.1 回溯 回溯法先全部求出来存起来备用 class CombinationIterator {vectorstring ans;string path;int id 0; public:CombinationIterator(string characters, int combinationLength){dfs(characters, combinationLength, 0);}void dfs(string s, int n, int idx){if(path.size() n){ans.push_back(path);return;}for(int i idx; i s.size(); i){path.push_back(s[i]);dfs(s, n, i1);//下一个字符只能更大1开始找path.pop_back();}}string next() {return ans[id];}bool hasNext() {return id ans.size();} };32 ms 12.8 MB 2.2 位运算 class CombinationIterator {int bits;string s;int len; public:CombinationIterator(string characters, int combinationLength) {s characters;bits (1s.size())-1;len combinationLength;}int countOne(int n){int count 0;while(n){count;n n (n-1);}return count;}string next() {while(bits 0 countOne(bits) ! len)bits--;string t;for(int i s.size()-1; i 0; --i){if((bitsi)1)t s[s.size()-i-1];//字符串是从左往右的序号0开始}bits--;//下一个数下次搜索的起点return t;}bool hasNext() {while(bits 0 countOne(bits) ! len)bits--;return bits 0;} };20 ms 12 MB
http://wiki.neutronadmin.com/news/119881/

相关文章:

  • 目录浏览的网站品牌设计理念
  • 做网站一个月可以赚多少钱阿里云个人域名备案流程
  • 网站开发案例教程威海建设局网站首页
  • 做网赌需要在哪些网站投广告销售推广方案
  • 公司网站建设 上海做鱼网站的域名
  • 佛山网站设计制作公司打开网页wordpress错误
  • 电子商务网站建设试验报告1外网不能访问wordpress
  • 如何做视频播放网站上热门的短视频素材
  • 形容网站做的好网站程序有哪些
  • 怎么把网站设置为信任网站查域名注册详细信息查询
  • 网站快速网站推广网址大全名称
  • 番禺人才网站电子产品展示网站
  • 网站建设需要哪些步骤 谢谢企业网站的设计风格
  • 赣州市网站建设wordpress配置文件
  • wordpress能做大站吗成都医疗网站建设
  • 用网站做宣传的方案建设一网站要多少钱
  • asp网站实现php栏目免费访问国外网站的app
  • 阿里 做网站seo排名优化公司
  • 网站分析培训班陕西服装网站建设
  • 可以做行程的网站黄骅市职教中心
  • 石林网站建设企业在网站推广
  • 网站建设外包 源代码福州网站设计十年乐云seo
  • 网站官网设计规范建设部促进中心网站
  • 软件开发周期包括哪几个阶段北京seo的排名优化
  • 动漫网站网页设计网站seo排名
  • 企业网站建设的重要性和必要性中国flash网站模板中心
  • 哪些网站做的好济宁建设信息网官网
  • 如何做网站帮别人赚钱水土保持与生态建设网站
  • 成都 企业 网站制作云南5个中风险地区
  • 新营销平台电商网站做暖暖视频网站大全