def find_base_path(paths)
      return nil if paths.length <= 1
      paths.sort!
      first = paths.first.split('/')
      last  = paths.last.split('/')
      i = 0
      while first[i] == last[i] && i <= first.length
        i += 1
      end
      res = first.slice(0, i).join('/')
      res.empty? ? nil : res
    end
def find_base_path(paths)
      return nil if paths.length <= 1
      paths.sort!
      first = paths.first.split('/')
      last  = paths.last.split('/')
      i = 0
      while first[i] == last[i] && i <= first.length
        i += 1
      end
      res = first.slice(0, i).join('/')
      res.empty? ? nil : res
    end
Given a set of paths, find a common prefix path.