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
| <html> | |
| <head> | |
| <title>Leap Year in JavaScript</title> | |
| <style type="text/css"> | |
| * { margin: 0 auto; width: 960px; background-color: blue; } | |
| #text_where { | |
| color: white; | |
| font-weight: bold; | |
| text-align: center; | |
| font-size: 40px; |
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
| <html> | |
| <head> | |
| <title>RPN Calculator</title> | |
| <style type="text/css"> | |
| body { | |
| color: white; | |
| background-color: blue; | |
| font-weight: bold; | |
| font-size: 24px; | |
| text-align: center; |
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
| def median(array) | |
| sorted_array = array.sort | |
| if array.length % 2 != 0 | |
| index = sorted_array.length / 2 | |
| median = sorted_array[index] | |
| else | |
| index = sorted_array.length / 2 | |
| median = (sorted_array[index].to_f + sorted_array[index-1].to_f) / 2 | |
| end | |
| end |
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
| def count_between(array, lower_bound, upper_count) | |
| times = [] | |
| until array.size == 0 | |
| check_num = array.pop | |
| if check_num.between?(lower_bound, upper_count) | |
| times « check_num | |
| end | |
| end | |
| times.length | |
| end |
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
| def mode(array) | |
| array.drop_while {|x| array.count(x) < array.count(x + 1) }.select {|x| array.count(x) > 1}.uniq | |
| end |
NewerOlder