摘要:
Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie... 阅读全文
摘要:
晚上看到一篇博客,作者是翻译《黑客与画家》的阮一峰。他说一个网站上有人提问:“最让你感到吃惊的信息是什么?” 有人回答:“人生只有900个月。”九百除以十二,计算器准确的告诉我等于七十五,这也差不多是现在的人均寿命。这当中还包括了睡觉吃饭闲扯漫无目的的时间,如果用一张A4纸打印出30x30的表格,每... 阅读全文
摘要:
Related to questionExcel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A ... 阅读全文
摘要:
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an... 阅读全文
摘要:
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文
摘要:
第二章类继承,属性,类变量1.如何声明一个子类class Treasure [:a] //只有aclass A def b puts 'b' endenda.public_methods(false)# => [:a, :b]//有a和b而不能修改的,是类继承了哪个类。比如class A... 阅读全文
摘要:
第一章字符串,数字,类和对象为了证明Ruby真的好用,hello world也能写的如此简洁:puts 'hello world'1.输入/输出print('Enter your name')name=gets()puts("Hello #{name}") 注:Ruby是区分大小写的2.Str... 阅读全文