Note.java 一个枚举类
package Lesson8Polymorphism.music;
public enum Note
{
MIDDLE_C, C_SHARP, B_FLAT;
}
music5.java
/**
* 书本:《Thinking In Java》
* 功能:接口
* 文件:Music.java
* 时间:2015年4月2日16:50:48
* 作...
分类:
编程语言 时间:
2015-04-18 08:43:33
阅读次数:
155
Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].二叉树...
分类:
其他好文 时间:
2015-04-17 22:06:08
阅读次数:
106
Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
分类:
其他好文 时间:
2015-04-16 23:42:02
阅读次数:
159
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo...
分类:
其他好文 时间:
2015-04-16 23:30:36
阅读次数:
126
Given a range [m, n] where 0 = 0 && ((m & (1 << t)) == (n & (1 << t)))) { ans |= m & (1 << t); t--; } retur...
分类:
其他好文 时间:
2015-04-16 23:17:08
阅读次数:
190
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321总结:处理整数溢出的方法①用数据类型转换long 或 long long②在每次循环时先保存下数字变化之前的值,处理后单步恢复...
分类:
其他好文 时间:
2015-04-15 22:42:09
阅读次数:
121
题意:一个长度为n的序列a,设其排过序之后为b,其中位数定义为b[n/2],其中a,b从0开始标号,除法取下整。给一个序列,并进行一些询问。每次询问起点在[a,b],终点在[c,d]的序列的中位数。题解:首先有一个思路:对于一个序列S,假设它的中位数是m,则S中>=m的元素个数一定>=n那么对于一个...
分类:
其他好文 时间:
2015-04-15 19:22:33
阅读次数:
148
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe...
分类:
其他好文 时间:
2015-04-15 18:28:59
阅读次数:
137
Description
For this problem, you will write a program that reads in a sequence of 32-bit signed integers. After each odd-indexed value is read, output the median (middle value) of the elements receiv...
分类:
编程语言 时间:
2015-04-14 12:55:57
阅读次数:
167
GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]...
分类:
其他好文 时间:
2015-04-10 20:00:18
阅读次数:
114