Halo

A magic place for coding

0%

Problem

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a cookie that the child will be content with; and each cookie j has a size sj. If sj >= gi, we can assign the cookie j to the child i, and the child i will be content. Your goal is to maximize the number of your content children and output the maximum number.

Note:
You may assume the greed factor is always positive.
You cannot assign more than one cookie to one child.

Read more »

Problem

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:

  • Integers in each row are sorted from left to right.
  • The first integer of each row is greater than the last integer of the previous row.
    Read more »

Problem

Given a non-negative index k where k ≤ 33, return the $k^{th}$ index row of the Pascal’s triangle.

Note that the row index starts from 0.

Animation

In Pascal’s triangle, each number is the sum of the two numbers directly above it.

Read more »

介绍

  如何打造一个充满个性的hexo个人博客呢?我们可以为自己的hexo博客配置个性化域名。这篇博客将会带你一步一步配置。先来看看效果,我的博客:博客网址,点击即可访问啦。

Read more »

Problem

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 assume all four edges of the grid are all surrounded by water.

Read more »