- Updating packages
sudo apt-get update
sudo apt-get upgrade
sudo apt-get clean
sudo apt-get autoremove
- Installing Vim
sudo apt-get vim
- Apply a .vimrc
- Change default editor
This file contains hidden or 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
# Calculate number of triangles (that don't contain triangles) inside a | |
# Sierpinski triangle | |
module Sierpinski | |
# @param [Integer] n - number of iterations | |
# @return [Integer] the number of triangles that don't contain triangles | |
# | |
# f(n) = 4(f(n - 1) - f(n - 2)) + f(n - 2) | |
# T(n) in O(n) | |
def self.triangles(n) | |
raise 'must be nonnegative' if n < 0 |
This file contains hidden or 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
## ----------------------------------------------------------------------------- | |
## Replace Type Code With Subclasses | |
## Replace Conditional with Polymorphism | |
## ----------------------------------------------------------------------------- | |
# Start | |
class Animal | |
def initialize(type_code) | |
@type_code = type_code |