This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
airplaneMode: false, | |
wifi: true, | |
bluetooth: true, | |
actions: { | |
setAirplaneMode(value) { | |
if (value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is what I wanted to do... | |
class MyObject < SomeSuperClass | |
include SomeWebService::DataSource | |
data_source_id '123456' # data_source_id() is a class method added by the module | |
def initialize(name) | |
@name = name | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is what I wanted to do... | |
class MyObject < SomeSuperClass | |
@@data_source_id = '123456' | |
@@data = nil | |
def initialize(name) | |
@name = name | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Road Removal | |
https://www.facebook.com/hackercup/problems.php?pid=278355025564990&round=154897681286317 | |
You are given a network with N cities and M bidirectional roads connecting these cities. The | |
first K cities are important. You need to remove the minimum number of roads such that in the | |
remaining network there are no cycles that contain important cities. A cycle is a sequence of | |
at least three different cities such that each pair of neighboring cities are connected by a | |
road and the first and the last city in the sequence are also connected by a road. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Monopoly | |
https://www.facebook.com/hackercup/problems.php?pid=299871816717968&round=154897681286317 | |
In a certain business sector there are currently N small companies, each having just a single | |
employee. These employees are numbered 1 through N. | |
The business sector is about to be transformed into a monopoly. This will happen through a | |
series of mergers, until there is only one company. A single merger involves two companies. | |
In a merger, the president of one company becomes the direct report of the president of the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sequence Slicing | |
https://www.facebook.com/hackercup/problems.php?pid=317343604974808&round=154897681286317 | |
Let S be a sequence of N natural numbers. We can define an infinite sequence MS in the | |
following way: MS[k] = S[k mod N] + N * floor(k / N). Where k is a zero based index. | |
For example if the sequence S is {2, 1, 3} then MS would be {2, 1, 3, 5, 4, 6, 8, 7, 9, | |
11, 10, 12...} |