Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding Ruby & method

In my first developper job interview I was asked to code the & method of Ruby a method which gives the intersection of two arrays. Given [1, 1, 1, 4, 5] and [1, 1, 4, 7], intersection must be [1, 1, 4].

Run times

My first ugly try (df9073112af3b750967e633373ff8f4ab98a87ef)

Finished in 0.00108 seconds (files took 0.06966 seconds to load)

Second try (4d7334c991a57d10b0413a8a51ce796284ee43db)

Finished in 0.00111 seconds (files took 0.06347 seconds to load)

with some improvement (af2f9f5ee7bd85124bca9498a405f423e1fa97ea)

Finished in 0.00108 seconds (files took 0.06432 seconds to load)

Third try

Finished in 0.00111 seconds (files took 0.06651 seconds to load)

About

The & method of Ruby which give the intersection of two arrays.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages