Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string.  Return a list of all possible strings we could create. Examples: Input: S = "a1b2" Output: ["a1b2", "a1B2",…
problem 784. Letter Case Permutation 参考 1. Leetcode_easy_784. Letter Case Permutation; 2. Grandyang; 完…
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 回溯法 循环 日期 题目地址:https://leetcode.com/problems/letter-case-permutation/description/ 题目描述 Given a string S, we can transform every letter individually to be lowercase or uppercase…
Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string.  Return a list of all possible strings we could create. Examples: Input: S = "a1b2" Output: ["a1b2", "a1B2",…
题目要求 Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string.  Return a list of all possible strings we could create. 题目分析及思路 给定一个字符串,考虑每个字母都有大小写,返回可能的所有字符串.由于每个字母都有两种形式,可结合二进制的思想,有n个字母就有2^n种…
[抄题]: Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string.  Return a list of all possible strings we could create. Examples: Input: S = "a1b2" Output: ["a1b2", "a1B2&q…
网址:https://leetcode.com/problems/letter-case-permutation/ basic backtracking class Solution { public: void backTrack(string s, string res, int i, vector<string> &ans) { if (i == s.size()) { ans.push_back(res); return; } if (!isalpha(s[i])) backT…
Examples: Input: S = "a1b2" Output: ["a1b2", "a1B2", "A1b2", "A1B2"] Input: S = "3z4" Output: ["3z4", "3Z4"] Input: S = "12345" Output: ["12345"] class Sol…
这个题的思想很重要,两种方法 第一种,回溯法 class Solution { public: int sz; vector<string> letterCasePermutation(string S) { vector<string> res; sz=S.size(); backtrack(S,,res); return res; } void backtrack(string &s,int i,vector<string> &res) { if(i…
Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the following cases holds: All letters in this word are capitals, like "USA". All letters in t…