随笔分类 -  LeetCode

上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页
摘要:A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128 阅读全文
posted @ 2017-11-21 10:57 __Meng 阅读(504) 评论(0) 推荐(0)
摘要:We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. Now, given an integer n, write 阅读全文
posted @ 2017-11-20 09:49 __Meng 阅读(184) 评论(0) 推荐(0)
摘要:Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library functio 阅读全文
posted @ 2017-11-19 22:10 __Meng 阅读(171) 评论(0) 推荐(0)
摘要: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 exa 阅读全文
posted @ 2017-11-18 13:24 __Meng 阅读(142) 评论(0) 推荐(0)
摘要:Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Example 2: java(14ms): 阅读全文
posted @ 2017-11-17 09:54 __Meng 阅读(149) 评论(0) 推荐(0)
摘要:Determine whether an integer is a palindrome. Do this without extra space. 判断一个数是不是回文数 C++(182ms): Java(188ms): 阅读全文
posted @ 2017-11-16 15:38 __Meng 阅读(172) 评论(0) 推荐(0)
摘要:Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: 字符串表示十进制数,求相加后的结果 C++(19ms): java(25ms): 阅读全文
posted @ 2017-11-14 10:33 __Meng 阅读(143) 评论(0) 推荐(0)
摘要:Given an m * n matrix M initialized with all 0's and several update operations. Operations are represented by a 2D array, and each operation is repres 阅读全文
posted @ 2017-11-13 09:51 __Meng 阅读(165) 评论(0) 推荐(0)
摘要:The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another n 阅读全文
posted @ 2017-11-11 19:12 __Meng 阅读(186) 评论(0) 推荐(0)
摘要:Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, return fa 阅读全文
posted @ 2017-11-10 14:57 __Meng 阅读(140) 评论(0) 推荐(0)
摘要:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit 阅读全文
posted @ 2017-11-09 19:26 __Meng 阅读(135) 评论(0) 推荐(0)
摘要:Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. Example 1: Example 2: 阅读全文
posted @ 2017-11-08 10:35 __Meng 阅读(200) 评论(0) 推荐(0)
摘要:Given an integer, write a function to determine if it is a power of two. Credits:Special thanks to @jianchao.li.fighter for adding this problem and cr 阅读全文
posted @ 2017-11-07 10:02 __Meng 阅读(152) 评论(0) 推荐(0)
摘要:We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an integer arra 阅读全文
posted @ 2017-11-06 10:25 __Meng 阅读(155) 评论(0) 推荐(0)
摘要:Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This 阅读全文
posted @ 2017-11-05 10:46 __Meng 阅读(157) 评论(0) 推荐(0)
摘要:Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You need to h 阅读全文
posted @ 2017-11-04 14:32 __Meng 阅读(141) 评论(0) 推荐(0)
摘要:Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each elemen 阅读全文
posted @ 2017-11-03 16:06 __Meng 阅读(151) 评论(0) 推荐(0)
摘要:Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat", t = 阅读全文
posted @ 2017-11-02 15:17 __Meng 阅读(136) 评论(0) 推荐(0)
摘要: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 intege 阅读全文
posted @ 2017-11-01 16:51 __Meng 阅读(227) 评论(0) 推荐(0)
摘要:Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of th 阅读全文
posted @ 2017-10-31 10:02 __Meng 阅读(188) 评论(0) 推荐(0)

上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页