数据结构与算法练习
文章平均质量分 94
热心市民Daisy
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[Leetcode]easy
Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use ...原创 2018-05-22 18:41:46 · 232 阅读 · 0 评论 -
[lintcode]入门
37. 反转一个3位整数 描述 反转一个只有3位数的整数。 你可以假设输入一定是一个只有三位数的整数,这个整数大于等于100,小于1000。 您在真实的面试中是否遇到过这个题? 是 样例 123 反转之后是 321。900 反转之后是 9。 class Solution { public: /** * @param number: A 3-digit numbe...原创 2018-08-22 17:15:18 · 799 阅读 · 0 评论 -
[lintcode] 简单
2. 尾部的零 描述 设计一个算法,计算出n阶乘中尾部零的个数 您在真实的面试中是否遇到过这个题? 是 样例 11! = 39916800,因此应该返回 2 挑战 O(logN)的时间复杂度 class Solution { public: /* * @param n: A long integer * @return: An integer,...原创 2018-08-22 19:39:05 · 651 阅读 · 0 评论 -
[leetcode] easy
1. 两数之和 给定一个整数数组和一个目标值,找出数组中和为目标值的两个数。 你可以假设每个输入只对应一种答案,且同样的元素不能被重复利用。 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 nums[0] + nums[1] = 2 + 7 = 9 所以返回 [0, 1] class Solution { public: vector&...原创 2018-08-22 12:19:06 · 506 阅读 · 0 评论
分享