File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,47 @@ names.select {|word| word.length > 5 }
29
29
' RubyMonk Is Pretty Brilliant' .gsub (/[A-Z] / , ' 0' )
30
30
' RubyMonk Is Pretty Brilliant' .match(/ ./ , 9 )
31
31
32
- Boolean
32
+ # ### Boolean
33
33
! (name== ' Bob' )
34
+ ```
35
+ ###Examples
34
36
37
+ ``` ruby
35
38
def sort_string (string )
36
39
string.split(' ' ).sort{|x , y | x.length <=> y.length}.join(' ' )
37
40
end
38
41
42
+ def random_select (array , n )
43
+ result = []
44
+ n.times do
45
+ result << array[rand (array.length)]
46
+ end
47
+ result
48
+ end
49
+
50
+ is_an_experienced_ruby_programmer =
51
+ (candidate.languages_worked_with.include? ' Ruby' ) &&
52
+ (candidate.years_of_experience >= 2 || candidate.github_points >= 500 ) &&
53
+ ! (candidate.age < 15 || candidate.applied_recently?)
54
+
55
+ def palindrome? (sentence )
56
+ s = sentence.downcase.gsub (" " ," " )
57
+ s == s.reverse
58
+ end
59
+
60
+ def sum_of_cubes (a , b )
61
+ (a..b).inject(0 ) { |sum , x | sum += (x* x* x) }
62
+ end
63
+
64
+ def non_duplicated_values (values )
65
+ unique = []
66
+ values.map do |i |
67
+ if values.count(i) < 2
68
+ unique << i
69
+ end
70
+ end
71
+ unique
72
+ endef sort_string(string)
73
+ string.split(' ' ).sort{|x , y | x.length <=> y.length}.join(' ' )
74
+ end
39
75
```
You can’t perform that action at this time.
0 commit comments