Examples:
Input: S = "a1b2"
Output: ["a1b2", "a1B2", "A1b2", "A1B2"] Input: S = "3z4"
Output: ["3z4", "3Z4"] Input: S = "12345"
Output: ["12345"]
class Solution {
public:
vector<string> letterCasePermutation(string S) {
vector<string> res;
int idx = ;
helper(S, idx, res);
return res;
} void helper(string& s, int idx, vector<string>& res) {
if (idx == s.size()) {
res.push_back(s);
return;
}
helper(s, idx + , res);
if (isalpha(s[idx])) {
s[idx] = islower(s[idx]) ? toupper(s[idx]) : tolower(s[idx]);
helper(s, idx + , res);
}
}
};

【easy】784. Letter Case Permutation的更多相关文章

  1. 【Leetcode_easy】784. Letter Case Permutation

    problem 784. Letter Case Permutation 参考 1. Leetcode_easy_784. Letter Case Permutation; 2. Grandyang; ...

  2. 【LeetCode】784. Letter Case Permutation 解题报告 (Python&C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 回溯法 循环 日期 题目地址:https://leet ...

  3. 784. Letter Case Permutation 字符串中字母的大小写组合

    [抄题]: Given a string S, we can transform every letter individually to be lowercase or uppercase to c ...

  4. leetcode 784. Letter Case Permutation——所有BFS和DFS的题目本质上都可以抽象为tree,这样方便你写代码

    Given a string S, we can transform every letter individually to be lowercase or uppercase to create ...

  5. LeetCode 784 Letter Case Permutation 解题报告

    题目要求 Given a string S, we can transform every letter individually to be lowercase or uppercase to cr ...

  6. [LeetCode&Python] Problem 784. Letter Case Permutation

    Given a string S, we can transform every letter individually to be lowercase or uppercase to create ...

  7. 784. Letter Case Permutation C++字母大小写全排列

    网址:https://leetcode.com/problems/letter-case-permutation/ basic backtracking class Solution { public ...

  8. 784. Letter Case Permutation

    这个题的思想很重要,两种方法 第一种,回溯法 class Solution { public: int sz; vector<string> letterCasePermutation(s ...

  9. 【LeetCode】17. Letter Combinations of a Phone Number 电话号码的字母组合

    作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 个人公众号:负雪明烛 本文关键词:电话号码, 字母组合,回溯法,题解,leetcode, ...

随机推荐

  1. 【学亮编程手记】Spring Cloud三大组件Eureka/Feign/Histrix的原理及使用

  2. fuser:command not found

    yum 安装fuser命令 yum install -y psmisc

  3. js 实现数据结构 -- 字典

    原文: 在Javascript 中学习数据结构与算法. 概念: 集合.字典.散列表都可以存储不重复的数据.字典和我们上面实现的集合很像. 当然,字典中的数据具有不重复的特性.js 中 Object 的 ...

  4. IFE第一天

    我也不知道自己到底能坚持多少天,希望66天可以坚持下来,flag在此. 第一天的知识大概就是了解一些基本概念. Web: 基于HTTP协议,利用浏览器访问网站. HTML 大概就是告诉浏览器我有一个什 ...

  5. word里面对齐用Tab键

    1       Tab      组1 2             组2

  6. leanote使用本地账户+坚果云同步

    1. 换机器后笔记无法显示 这是因为新建账户与原账户userid不一致. 正确的同步方式为: 下载leanote并解压,不运行,不新建账户 从坚果云同步leanote数据 创建leanote的数据目录 ...

  7. vscode笔记(一)- vscode自动生成文件头部注释和函数注释

    VsCode 自动生成文件头部注释和函数注释 作者:狐狸家的鱼 本文链接:vscode自动生成文件头部注释和函数注释 GitHub:sueRimn 1.安装插件KoroFileHeader 2.设置 ...

  8. 【一本通1329:【例8.2】细胞&&洛谷P1451 求细胞数量】

    1329:[例8.2]细胞 [题目描述] 一矩形阵列由数字0到9组成,数字1到9代表细胞,细胞的定义为沿细胞数字上下左右还是细胞数字则为同一细胞,求给定矩形阵列的细胞个数.如: 阵列 4 10 023 ...

  9. 主成分分析_PCA解释

    粘贴自:http://blog.codinglabs.org/articles/pca-tutorial.html 数据的向量表示及降维问题 向量的表示及基变换 协方差矩阵及优化目标 协方差矩阵对角化 ...

  10. jsp:forward动作功能

    jsp:forward动作:引导请求者进入新的页面 例子:login.jsp <center><p>用户登录 </p> <form name="fo ...