摘要:
闲来无事,不如试着用ruby刷刷题 1. Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume 阅读全文
摘要:
Array#bsearch bsearch { |x| ... } -> object | nil bsearch -> Enumerator 基于块评估结果来判断范围中的每个元素,并且通过二进制搜索来搜索满足条件的值(计算量为O(log n))。如果找不到该元素,则返回nil。Array 必须事先 阅读全文