上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 56 下一页

2021年6月13日

摘要: 题目描述 给定一个整数 n,返回 n! 结果尾数中零的数量。 示例 1: 输入: 3 输出: 0 解释: 3! = 6, 尾数中没有零。 示例 2: 输入: 5 输出: 1 解释: 5! = 120, 尾数中有 1 个零. 说明: 你算法的时间复杂度应为 O(log n) 。 思路 其实也就是求阶乘 阅读全文
posted @ 2021-06-13 17:13 朴素贝叶斯 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给定一个包含 0, 1, 2, ..., n 中 n 个数的序列,找出 0 .. n 中没有出现在序列中的那个数。 示例 1: 输入: [3,0,1] 输出: 2 示例 2: 输入: [9,6,4,2,3,5,7,0,1] 输出: 8 说明: 你的算法应具有线性时间复杂度。你能否仅使用额外 阅读全文
posted @ 2021-06-13 16:27 朴素贝叶斯 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给定一个整数数组 nums,其中恰好有两个元素只出现一次,其余所有元素均出现两次。 找出只出现一次的那两个元素。 示例 : 输入: [1,2,1,3,2,5] 输出: [3,5] 注意: 结果输出的顺序并不重要,对于上面的例子, [5, 3] 也是正确答案。你的算法应该具有线性时间复杂度。 阅读全文
posted @ 2021-06-13 15:46 朴素贝叶斯 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear run 阅读全文
posted @ 2021-06-13 15:12 朴素贝叶斯 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime 阅读全文
posted @ 2021-06-13 14:25 朴素贝叶斯 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 题目描述 反转一个单链表。 示例: 输入: 1->2->3->4->5->NULL 输出: 5->4->3->2->1->NULL 进阶: 你可以迭代或递归地反转链表。你能否用两种方法解决这道题? /** * Definition for singly-linked list. * struct L 阅读全文
posted @ 2021-06-13 13:36 朴素贝叶斯 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 题目描述 You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can yo 阅读全文
posted @ 2021-06-13 12:55 朴素贝叶斯 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 阅读全文
posted @ 2021-06-13 12:17 朴素贝叶斯 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identic 阅读全文
posted @ 2021-06-13 11:42 朴素贝叶斯 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 uniqu 阅读全文
posted @ 2021-06-13 11:16 朴素贝叶斯 阅读(25) 评论(0) 推荐(0) 编辑
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 56 下一页

导航