Fork me on GitHub
摘要: 结果: 结论:调用构造器的步骤: (1)调用基类的构造器。这个步骤会不断的反复递归下去,首先是构造这种层次结构的根,然后是下一层导出类,等等,直至最低层的导出类。 (2)按声明顺序调用成员的初始化方法。 (3)调用导出类构造器的主体。 阅读全文
posted @ 2019-07-24 16:56 gentleKay 阅读(188) 评论(0) 推荐(0) 编辑
摘要: /** * * @author gentleKay * Given a linked list, determine if it has a cycle in it. * Follow up: * Can you solve it without using extra space? * * 给定一 阅读全文
posted @ 2019-07-24 15:11 gentleKay 阅读(185) 评论(0) 推荐(0) 编辑
摘要: /** * * @author gentleKay * Given an integer, convert it to a roman numeral. * Input is guaranteed to be within the range from 1 to 3999. * * 给定一个整数,将 阅读全文
posted @ 2019-07-24 15:10 gentleKay 阅读(196) 评论(0) 推荐(0) 编辑
摘要: /** * @author gentleKay * Given n non-negative integers a1 , a2 , ..., an , where each represents a point at coordinate (i, ai ). * n vertical lines a 阅读全文
posted @ 2019-07-24 15:09 gentleKay 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 我们创建一个基类 Shape,然后Circle和Square 继承Shape。 第一种情况:Circle 和 Square 都不覆盖基类的方法。 结果: 第二种情况:Circle 覆盖基类方法 而 Square 不覆盖基类的方法。 结果: 第三种情况:Circle 和 Square 都覆盖基类的方法 阅读全文
posted @ 2019-07-24 11:00 gentleKay 阅读(287) 评论(0) 推荐(0) 编辑
摘要: /** * * @author gentleKay * Reverse digits of an integer. * Example1: x = 123, return 321 * Example2: x = -123, return -321 * click to show spoilers. 阅读全文
posted @ 2019-07-24 10:51 gentleKay 阅读(154) 评论(0) 推荐(0) 编辑
摘要: /** * @author gentleKay * Say you have an array for which the i th element is the price of a given stock on day i. * Design an algorithm to find the m 阅读全文
posted @ 2019-07-24 10:47 gentleKay 阅读(143) 评论(0) 推荐(0) 编辑