Skip to content

735. Asteroid Collision #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2019
Merged

735. Asteroid Collision #67

merged 1 commit into from
Jan 14, 2019

Conversation

zwfang
Copy link
Collaborator

@zwfang zwfang commented Jan 14, 2019

https://leetcode.com/problems/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.

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

@zwfang zwfang added Medium Coefficient of difficulty medium stack LIFO, a stack is an abstract data type that serves as a collection of elements (push, pop) labels Jan 14, 2019
@codecov
Copy link

codecov bot commented Jan 14, 2019

Codecov Report

Merging #67 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #67      +/-   ##
==========================================
+ Coverage    99.3%   99.31%   +0.01%     
==========================================
  Files         108      109       +1     
  Lines        1850     1865      +15     
==========================================
+ Hits         1837     1852      +15     
  Misses          9        9              
  Partials        4        4
Impacted Files Coverage Δ
src/0735_asteroid_collision/ac.go 100% <100%> (ø)

@zwfang zwfang merged commit 0b681a0 into master Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Medium Coefficient of difficulty medium stack LIFO, a stack is an abstract data type that serves as a collection of elements (push, pop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant