上一页 1 2 3 4 5 6 7 8 9 10 ··· 44 下一页
摘要: 问题: 求有多少个数的阶乘结果,末尾含有K个0的。 Example 1: Input: K = 0 Output: 5 Explanation: 0!, 1!, 2!, 3!, and 4! end with K = 0 zeroes. Example 2: Input: K = 5 Output: 阅读全文
posted @ 2021-03-24 15:55 habibah_chang 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 问题: 求给定n的阶乘结果中,有多少个0。 Example 1: Input: n = 3 Output: 0 Explanation: 3! = 6, no trailing zero. Example 2: Input: n = 5 Output: 1 Explanation: 5! = 120 阅读全文
posted @ 2021-03-24 15:05 habibah_chang 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定1~n个节点,构成(前序,中序,后序,其中任意一种)遍历的序列, 求可构成的二叉树的种类个数。 Example 1: Input: n = 3 Output: 5 Example 2: Input: n = 1 Output: 1 Constraints: 1 <= n <= 19 ex 阅读全文
posted @ 2021-03-23 16:01 habibah_chang 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定1~n个节点,(根据1~n构成<前序,中序,后序,其中一种>遍历序列,求可构成的二叉树种类) 令这些节点构成二叉树,求所能构成的所有(不重复)二叉树。 Example 1: Input: n = 3 Output: [[1,null,2,null,3],[1,null,3,2],[2,1 阅读全文
posted @ 2021-03-23 14:51 habibah_chang 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定由0~9构成的编码字符串。 编码前, 'A' -> "1" 'B' -> "2" ... 'Z' -> "26" 按照以上方法进行编码。 求编码前的字符串组合的可能数。 Example 1: Input: s = "12" Output: 2 Explanation: "12" coul 阅读全文
posted @ 2021-03-23 14:02 habibah_chang 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一组数,其中每个数字都出现2次, 只有一个数字出现了一次。求这个数字。 Example 1: Input: nums = [2,2,1] Output: 1 Example 2: Input: nums = [4,1,2,1,2] Output: 4 Example 3: Input: 阅读全文
posted @ 2021-03-23 13:14 habibah_chang 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 问题: 求给定数是否为2的幂。 Example 1: Input: n = 1 Output: true Explanation: 20 = 1 Example 2: Input: n = 16 Output: true Explanation: 24 = 16 Example 3: Input: 阅读全文
posted @ 2021-03-23 12:28 habibah_chang 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定32位无符号整型数 uint32_t n 求该数中1出现的次数。 Example 1: Input: n = 00000000000000000000000000001011 Output: 3 Explanation: The input binary string 000000000 阅读全文
posted @ 2021-03-23 12:07 habibah_chang 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 1.算法运算: 1.1. 获得最低非0位: 1 //获取x的最低1位。 2 //e.g. 6 = 0110 3 //获得 2 = 10 4 // x=0110, -x=(~x+1)=(1001+1)=1010 5 // x&(-x) = 0110 & 1010 = 0010 6 int lowbit 阅读全文
posted @ 2021-03-23 11:32 habibah_chang 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 问题: 求给定的两个字符串S1和S2是否 S1能经过以下变换得到S2。 若字符串长度为1,直接返回。 从任意index,进行切分,pre和post两部分, 可以选择:是否对这两部分进行交换。 然后,再将分割后的两部分,分别作为对象字符串,重复上述两个操作。 Example 1: Input: s1 阅读全文
posted @ 2021-03-22 17:50 habibah_chang 阅读(34) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 44 下一页