演员的自我修养


  • 首页

  • 关于我

  • 标签

  • 归档

  • 搜索

Leetcode 823 Binary Trees With Factors

发表于 2018-05-11 |

Given an array of unique integers, each integer is strictly greater than 1.

We make a binary tree using these integers and each number may be used for any number of times.

Each non-leaf node’s value should be equal to the product of the values of it’s children.

How many binary trees can we make? Return the answer modulo 10 ** 9 + 7.

阅读全文 »

Leetcode 824 Goat Latin

发表于 2018-05-11 |

图1

图2

阅读全文 »

Leetcode_825_Friends_Of_Appropriate_Ages

发表于 2018-05-11 |

Some people will make friend requests. The list of their ages is given and ages[i] is the age of the ith person.

Person A will NOT friend request person B (B != A) if any of the following conditions are true:

1.age[B] <= 0.5 * age[A] + 7
2.age[B] > age[A]
3.age[B] > 100 && age[A] < 100
Otherwise, A will friend request B.

Note that if A requests B, B does not necessarily request A. Also, people will not friend request themselves.

How many total friend requests are made?

阅读全文 »

Leetcode_826_Most_Profit_Assigning_Work

发表于 2018-05-11 |

We have jobs: difficulty[i] is the difficulty of the ith job, and profit[i] is the profit of the ith job.

Now we have some workers. worker[i] is the ability of the ith worker, which means that this worker can only complete a job with difficulty at most worker[i].

Every worker can be assigned at most one job, but one job can be completed multiple times.

For example, if 3 people attempt the same job that pays $1, then the total profit will be $3. If a worker cannot complete any job, his profit is $0.

What is the most profit we can make?

阅读全文 »

Leetcode_827_Making_A_Large_Island

发表于 2018-05-11 |

In a 2D grid of 0s and 1s, we change at most one 0 to a 1.

After, what is the size of the largest island? (An island is a 4-directionally connected group of 1s).

Example 1:
Input: [[1, 0], [0, 1]]
Output: 3
Explanation: Change one 0 to 1 and connect two 1s, then we get an island with area = 3.

阅读全文 »

Leetcode 829 Consecutive Numbers Sum

发表于 2018-05-10 |

Given a positive integer N,how many ways can we write it as a sum of consecutive positive integers?

Example 1:

Input: 5
Output: 2
Explanation: 5 = 5 = 2+3

阅读全文 »

Leetcode 831 Masking Personal Information

发表于 2018-05-07 |

这是题目描述

阅读全文 »

Leetcode 830 Positions of Large Groups

发表于 2018-05-06 |

In a string S of lowercase letters, these letters form consecutive groups of the same character.

For example, a string like S = “abbxxxxzyy” has the groups “a”, “bb”, “xxxx”, “z” and “yy”.

Call a group large if it has 3 or more characters. We would like the starting and ending positions of every large group.

The final answer should be in lexicographic order.

Example 1:
Input: “abbxxxxzzy”
Output: [[3,6]]
Explanation: “xxxx” is the single large group with starting 3 and ending positions 6.

阅读全文 »
1…1819
王琛

王琛

我要证明谁才是世界第一的actor

188 日志
27 标签
RSS
© 2020 王琛
本站访客数:
本站总访问量次