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

[LeetCode] Number of Islands

This is a typical problem about searching. In fact, you can use either BFS or DFS for it. Personally, I use BFS because I think it is more intuitive and easy to implement. The idea is fairly simp...

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

[LeetCode] Letter Combinations of a Phone Number

Well, a typical backtracking problem. Make sure you are clear with the following three problems: What is a partial solution and when is it finished? --- In this problem, the partial solution is a co.....

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

[LeetCode]65.Valid Number

题目 Validate if a given string is numeric. Some examples: “0” => true ” 0.1 ” => true “abc” => false “1 a” => false “2e10” => true Note: It is intended for the problem statement...

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

[LeetCode] Largest Number

Well, this problem is designed for radix sort. For more information about radix sort, Introduction to Algorithms, 3rd edition has some nice examples. However, it can be solved simply by using the sor....

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

[LeetCode] Number of Islands

Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assum....

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

leetcode 202 Happy Number

  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 integer, replace the number by the sum of the squ...

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

[LeetCode] Happy Number

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 integer, replace the number by the sum of the squares .....

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

[LeetCode]202.Happy Number

题目 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 integer, replace the number by the sum of the squa...

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

[LeetCode]191.Number of 1 Bits

题目 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 integer ’11’ has binary representation 00000...

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

[LeetCode]200.Number of Islands

题目 Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may a.....

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

算法编程

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

+关注