上一页 1 ··· 40 41 42 43 44 45 46 47 48 ··· 56 下一页

2021年5月3日

摘要: 题目描述 实现获取下一个排列的函数,算法需要将给定数字序列重新排列成字典序中下一个更大的排列。如果不存在下一个更大的排列,则将数字重新排列成最小的排列(即升序排列)。 必须原地修改,只允许使用额外常数空间。 以下是一些例子,输入位于左侧列,其相应输出位于右侧列。 1,2,3 → 1,3,2 3,2, 阅读全文
posted @ 2021-05-03 13:22 朴素贝叶斯 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给定一个可包含重复数字的序列,返回所有不重复的全排列。 示例: 输入: [1,1,2] 输出: [ [1,1,2], [1,2,1], [2,1,1] ] 思路 相当于找出所有不同的num.size()元组来,我们只需要保证设计程序时,对于这个元组每个位置的可能情况枚举时,每次做到不重复, 阅读全文
posted @ 2021-05-03 10:58 朴素贝叶斯 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给定一个没有重复数字的序列,返回其所有可能的全排列。 示例: 输入: [1,2,3] 输出: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ] 代码 class Solution { public: vector<vector 阅读全文
posted @ 2021-05-03 09:15 朴素贝叶斯 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Given a collection of integers that might contain duplicates, S, return all possible subsets. Note: Elements in a subset must be in non-descendin 阅读全文
posted @ 2021-05-03 08:40 朴素贝叶斯 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be in non-descending order(非下降顺序,升序).The soluti 阅读全文
posted @ 2021-05-03 07:53 朴素贝叶斯 阅读(45) 评论(0) 推荐(0) 编辑

2021年5月2日

摘要: 题目描述 Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each wor 阅读全文
posted @ 2021-05-02 23:19 朴素贝叶斯 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. 阅读全文
posted @ 2021-05-02 22:01 朴素贝叶斯 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给定一个仅包含大小写字母和空格 ' ' 的字符串,返回其最后一个单词的长度。如果不存在最后一个单词,请返回 0 。 说明:一个单词是指由字母组成,但不包含任何空格的字符串。 示例: 输入: "Hello World" 输出: 5 代码实现 class Solution { public: 阅读全文
posted @ 2021-05-02 20:34 朴素贝叶斯 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Given two words (beginWord and endWord), and a dictionarys word list, find all shortest transformation sequence(s) from beginWord o endWord, such 阅读全文
posted @ 2021-05-02 19:41 朴素贝叶斯 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给定两个单词(beginWord 和 endWord)和一个字典,找到从 beginWord 到 endWord 的最短转换序列的长度。转换需遵循如下规则: 每次转换只能改变一个字母。 转换过程中的中间单词必须是字典中的单词。 说明: 如果不存在这样的转换序列,返回 0。 所有单词具有相同 阅读全文
posted @ 2021-05-02 18:32 朴素贝叶斯 阅读(39) 评论(0) 推荐(0) 编辑
上一页 1 ··· 40 41 42 43 44 45 46 47 48 ··· 56 下一页

导航