![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
小一郎
这个作者很懒,什么都没留下…
展开
-
leetcode 172-Factorial Trailing Zeroes
原题: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 思路: 数字结尾每个0相当于一组2与5的乘积,因子只要知道n!中包含多少对质因子2和5,结尾就有多少个0. 由于质因原创 2015-01-30 10:58:34 · 432 阅读 · 0 评论 -
leetcode 14-Longest Common Prefix
原题: Write a function to find the longest common prefix string amongst an array of strings. 即求一组字符串的最长公共前缀 思路: 暴力法,以字符串数组中第一个字符串为基准,遍历第一个字符串,依次将该字符串中的字符与其他字符串相应位置中的字符进行比较。相同则继续,不同则退出,返回上一次循环的结果。原创 2014-12-31 09:31:39 · 356 阅读 · 0 评论 -
leetcode 20-Valid Parentheses
原题: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are原创 2014-12-26 15:03:28 · 480 阅读 · 0 评论 -
leetcode 160-Intersection of Two Linked Lists
原题: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → a2 ↘原创 2014-12-23 10:06:54 · 345 阅读 · 0 评论 -
leetcode 171-Excel Sheet Column Number
原题: Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 即原创 2014-12-30 16:16:58 · 463 阅读 · 0 评论 -
leetcode 125-Valid Palindrome
原题: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man, a plan, a canal: Panama" is a palindrome. "race a car"原创 2014-12-23 18:17:07 · 351 阅读 · 0 评论 -
leetcode 169-Majority Element
原题: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority原创 2014-12-22 15:19:09 · 449 阅读 · 0 评论 -
leetcode 70-Climbing Stairs
原题: 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 you climb to the top? 思路:1. 第一步有两种情况 (跨一步和跨原创 2014-12-08 23:36:30 · 728 阅读 · 0 评论 -
leetcode 168-Excel Sheet Column Title
原题: Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB原创 2014-12-22 10:26:39 · 420 阅读 · 0 评论