文章 2015-08-18 来自:开发者社区

[LeetCode] Strobogrammatic Number III

The idea is similar to Strobogrammatic Number II: generate all those in-range strobogrammatic numbers and count. You may refer to this link for a very readable code, which I have rewritten in C++ bel....

文章 2015-08-17 来自:开发者社区

[LeetCode] Single Number III

Try to split all the numbers into two groups with each of the target one in different groups. Refer to this link for a nice explanation. The code is written as follows. 1 class Solution { 2 public...

文章 2015-08-17 来自:开发者社区

[LeetCode] Happy Number

Well, no matter whether the number is happy or not, its sum-of-squared-digits sequance has a cycle. Well, do you still remember the algorithm for detecting cycles in linked lists? Yeah, use a fast an....

文章 2015-08-15 来自:开发者社区

[LeetCode] Palindrome Number

The most obvious idea is to maintain two divisors to get the most and least significant digits and compare them. Well, there are much more clever ideas, like this one, whose code is rewritten bel...

文章 2015-08-08 来自:开发者社区

[LeetCode] Strobogrammatic Number II

This problem can be solved easily once you find the regularities :-) This link has done it for you. You may refer to its Python version. I rewrite it in C++ below. 1 class Solution { 2 public: 3 ...

文章 2015-08-06 来自:开发者社区

[LeetCode] Strobogrammatic Number

Problem Description: A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a number is strobogrammatic. The numbe....

文章 2015-07-19 来自:开发者社区

[LeetCode]233.Number of Digit One

题目 Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. For example: Given n = 13, Return 6, because digit 1 occurred in the follo...

文章 2015-07-11 来自:开发者社区

[LeetCode] Valid Number

I guess some of you may have noticed that this seemingly simple problem has the lowest acceptance rate among all problems on the LeetCode OJ. Well, some of you may also complain about the annoying la....

文章 2015-07-08 来自:开发者社区

[LeetCode] Number of Digit One

The following idea is taken from a book named 《剑指offer》 published in China. Suppose n = 271, it then breaks [1, 271] into [1, 71] and [72, 271]. For [72, 271], the n...

文章 2015-06-28 来自:开发者社区

leetcode 9 Palindrome Number 回文数

Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hints: Could negative integers be palindromes? (ie, -1) If you are thinking of converting ...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

算法编程

开发者社区在线编程频道官方技术圈。包含算法资源更新,周赛动态,每日一题互动。

+关注