784. 字母大小写全排列 给定一个字符串S,通过将字符串S中的每个字母转变大小写,我们可以获得一个新的字符串.返回所有可能得到的字符串集合. 示例: 输入: S = "a1b2" 输出: ["a1b2", "a1B2", "A1b2", "A1B2"] 输入: S = "3z4" 输出: ["3z4", "3Z4"] 输入: S = "…
https://leetcode-cn.com/problems/letter-case-permutation/solution/shen-du-you-xian-bian-li-hui-su-suan-fa-python-dai/ 描述 给定一个字符串S,通过将字符串S中的每个字母转变大小写,我们可以获得一个新的字符串.返回所有可能得到的字符串集合. 示例:输入: S = "a1b2"输出: ["a1b2", "a1B2", "A1…
给定一个字符串S,通过将字符串S中的每个字母转变大小写,我们可以获得一个新的字符串.返回所有可能得到的字符串集合. 示例: 输入: S = "a1b2" 输出: ["a1b2", "a1B2", "A1b2", "A1B2"] 输入: S = "3z4" 输出: ["3z4", "3Z4"] 输入: S = "12345" 输出…
网址: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…
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. Examples: Input: S = "a1b2" Output: ["a1b2", "a1B2",…
给定一个字符串S,通过将字符串S中的每个字母转变大小写,我们可以获得一个新的字符串.返回所有可能得到的字符串集合. 示例: 输入: S = "a1b2" 输出: ["a1b2", "a1B2", "A1b2", "A1B2"] 输入: S = "3z4" 输出: ["3z4", "3Z4"] 输入: S = "12345" 输出…
Java对字母大小写转换 1.小写——大写String aa = "abc".toUpperCase(); 2.大写——小写 String bb = "ABC".toLowerCase();…
String字符串需要进行首字母大小写改写,查询google,就是将首字母截取,转化大小写 + 首字母后面字符串 //首字母小写 public static String captureName(String name) { name = name.substring(0, 1).toLowerCase() + name.substring(1);//UpperCase大写 return name; } 这种效率并不高,之前有个牛人的写的非常牛X的算法,找不到博客了. 就是 进行字母的ascii…
题目 传送门 如果一个十进制数字不含任何前导零,且每一位上的数字不是 0 就是 1 ,那么该数字就是一个 十-二进制数 .例如,101 和 1100 都是 十-二进制数,而 112 和 3001 不是. 给你一个表示十进制整数的字符串 n ,返回和为 n 的 十-二进制数 的最少数目. 示例 1: 输入:n = "32" 输出:3 解释:10 + 11 + 11 = 32 示例 2: 输入:n = "82734" 输出:8 示例 3: 输入:n = "27…