def solution(a, x, d) k = a.size position = 0 if position+d >= x return 0; end (0..k).each do |i| if (a[i] - position) <= d
Ahmad Hassan ahmadhasankhan
Ruby and Rails Interview Questions
- What is a class?
- What is an object?
- What is a module? Can you tell me the difference between classes and modules?
- Can you tell me the three levels of method access control for classes and modules? What do they imply about the method?
- There are three ways to invoke a method in ruby. Can you give me at least two?
- Explain this ruby idiom: a ||= b
The Rails Style Guide
This Rails style guide recommends best practices so that real-world Rails programmers can write code that can be maintained by other real-world Rails programmers. A style guide that reflects real-world usage gets used, and a style guide that holds to an ideal that has been rejected by the people it is supposed to help risks not getting used at all – no matter how good it is.
The guide is separated into several sections of related rules. I've tried to add