摘要:题目: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 这题主要是计算n!中有多少个5存在,有5
阅读全文
摘要:题目: Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the
阅读全文
摘要:题目: Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 简单题。
阅读全文
摘要:题目: Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 应该说还是比较简单的。
阅读全文
摘要:题目: Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Given s = "hello", return "holle". Example 2:Give
阅读全文
摘要:题目: Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example 简单题
阅读全文
摘要:题目: Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100".
阅读全文
摘要:题目: Description: Count the number of prime numbers less than a non-negative number, n. 这个题目有提示,计算素数的方法应该不用多说。
阅读全文
摘要:题目: Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left corner and top right corner
阅读全文
摘要:题目: Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example
阅读全文
摘要:题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is l
阅读全文
摘要:题目: Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For
阅读全文
摘要:题目: Determine whether an integer is a palindrome. Do this without extra space. 简单题。看到两个比较好的解法,一个是把数字转化为字符串,然后首尾对比,往中间靠。另一种是数字分别从两头求和(保留位数:*10 + 余数),如果
阅读全文
摘要:题目: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see be
阅读全文
摘要:题目 Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 简单题,需要考虑两个问题,1)如果输入的末尾是0怎么办?2)如果倒过来的数字溢出了怎么办?
阅读全文
摘要:题目: Given an integer, write a function to determine if it is a power of two. 非常简单的一道题目
阅读全文
摘要:题目: Given a linked list, remove the nth node from the end of list and return its head. For example, 首先容易想到的是先遍历一次链表,计算链表长度L,然后再次遍历到L-n的位置删除结点。更好的办法是应用
阅读全文
摘要:题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lis 相对还是简单的,
阅读全文
摘要:题目: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 ->
阅读全文
摘要:题目: Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Yo
阅读全文
摘要:题目: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: 判断两个链表是
阅读全文
摘要:题目: Reverse a singly linked list. click to show more hints. Hint: A linked list can be reversed either iteratively or recursively. Could you implement
阅读全文
摘要:题目: Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 -->
阅读全文
摘要:题目: Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3
阅读全文
摘要:题目: Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 让head不断走一步,如果cur不为null,走两步,这样如果存在cy
阅读全文
摘要:题目: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter
阅读全文
摘要:题目: Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive in
阅读全文