📣 Back to School开学季 - VIP通行证5折优惠!蓝莓、Offer多多同步优惠
楼主: ttgao
跳转到指定楼层
上一主题 下一主题
收起左侧

立贴!从今天开始刷题。

🔗
 楼主| ttgao 2019-6-13 12:59:44 | 只看该作者
全局:
重刷21. Merge Two Sorted Lists
回复

使用道具 举报

🔗
 楼主| ttgao 2019-6-13 14:15:05 | 只看该作者
全局:
重刷 23. Merge k Sorted Lists
回复

使用道具 举报

🔗
 楼主| ttgao 2019-6-13 14:23:10 | 只看该作者
全局:
重刷 20. Valid Parentheses
回复

使用道具 举报

🔗
 楼主| ttgao 2019-6-14 13:43:30 | 只看该作者
全局:
Design Tic-Tac-Toe

回复

使用道具 举报

🔗
 楼主| ttgao 2019-6-19 12:10:40 | 只看该作者
全局:
829. Consecutive Numbers Sum

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
Example 2:

Input: 9
Output: 3
Explanation: 9 = 9 = 4 + 5 = 2 + 3 + 4
Example 3:

Input: 15
Output: 4
Explanation: 15 = 15 = 8 + 7 = 4 + 5 + 6 = 1 + 2 + 3 + 4 + 5
Note: 1 <= N <= 10 ^ 9.
回复

使用道具 举报

🔗
 楼主| ttgao 2019-6-19 12:54:15 | 只看该作者
全局:
此题其实就是一个数学公式,比较简单。
回复

使用道具 举报

🔗
 楼主| ttgao 2019-6-20 12:59:17 | 只看该作者
全局:
735. Asteroid Collision

We are given an array asteroids of integers representing asteroids in a row.

For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.

Find out the state of the asteroids after all collisions. If two asteroids meet, the smaller one will explode. If both are the same size, both will explode. Two asteroids moving in the same direction will never meet.

Example 1:
Input:
asteroids = [5, 10, -5]
Output: [5, 10]
Explanation:
The 10 and -5 collide resulting in 10.  The 5 and 10 never collide.
Example 2:
Input:
asteroids = [8, -8]
Output: []
Explanation:
The 8 and -8 collide exploding each other.
Example 3:
Input:
asteroids = [10, 2, -5]
Output: [10]
Explanation:
The 2 and -5 collide resulting in -5.  The 10 and -5 collide resulting in 10.
Example 4:
Input:
asteroids = [-2, -1, 1, 2]
Output: [-2, -1, 1, 2]
Explanation:
The -2 and -1 are moving left, while the 1 and 2 are moving right.
Asteroids moving the same direction never meet, so no asteroids will meet each other.
Note:

The length of asteroids will be at most 10000.
Each asteroid will be a non-zero integer in the range [-1000, 1000]..
回复

使用道具 举报

🔗
 楼主| ttgao 2019-6-20 13:49:29 | 只看该作者
全局:
用stack来解决问题。
回复

使用道具 举报

🔗
 楼主| ttgao 2019-7-3 12:48:42 | 只看该作者
全局:
4 Median of Two Sorted Arrays
回复

使用道具 举报

🔗
 楼主| ttgao 2019-7-3 12:49:08 | 只看该作者
全局:
两分查找,此题需要再抽空看一下。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表