杂题
文章平均质量分 60
tangyifei1991
这个作者很懒,什么都没留下…
展开
-
Insert Interval 插入区间
/** * Definition for an interval. * struct Interval { * int start; * int end; * Interval() : start(0), end(0) {} * Interval(int s, int e) : start(s), end(e) {} * }; */原创 2014-01-21 19:15:31 · 405 阅读 · 0 评论 -
阿里java面试题
(1)JVM如何加载一个类的过程,双亲委派模型中有哪些方法?类的生命周期:加载、(验证、准备、解析)链接、初始化、使用和卸载七个阶段其中类加载的过程包括了加载、验证、准备、解析、初始化五个阶段。在这五个阶段中,加载、验证、准备和初始化这四个阶段发生的顺序是确定的,而解析阶段则不一定,它在某些情况下可以在初始化阶段之后开始,这是为了支持 Java 语言的运行时绑定(也成为动态绑定或晚期绑定)。加载阶...转载 2018-02-19 19:40:24 · 555 阅读 · 0 评论 -
java面试题
1,java堆,分新生代老年代,新生代有Eden,from surviver,to surviver三个空间,堆被所有线程共。eden内存不足时,发生一次minor GC,会把from survivor和eden的对象复制到to survivor,这次的to survivor就变成了下次的from survivor,经过多次minor GC,默认15次,达到次数的对象会从survivor进行老年代...转载 2018-02-19 19:23:33 · 192 阅读 · 0 评论 -
Divide Two Integers 两个整数相除
class Solution { public: int divide(int dividend, int divisor) { bool sign=(dividend0)||(dividend>0&&divisor long long a=abs((double)dividend); long long b=abs((doubl原创 2014-01-21 20:55:07 · 325 阅读 · 0 评论 -
Spiral Matrix 螺旋矩阵I
class Solution { public: vector spiralOrder(vector > &matrix) { int minX,minY,maxX,maxY,x,y; vector ret; if(matrix.size()==0) return ret; minX=minY=0; maxX=matrix.size()-1; maxY原创 2014-01-21 20:50:04 · 382 阅读 · 0 评论 -
Pascal's Triangle II 帕斯卡三角形II
class Solution { public: vector getRow(int rowIndex) { vector ret; for(int i=0;i { ret.push_back(1); for(int j=i-1;j>0;j--) {原创 2014-01-21 20:48:04 · 328 阅读 · 0 评论 -
Pascal’s Triangle 帕斯卡三角形I
class Solution { public: vector > generate(int numRows) { vector> ret; if(numRows==0) return ret; vector tmp; tmp.push_back(1); ret.push_bac原创 2014-01-21 20:45:30 · 405 阅读 · 0 评论 -
Palindrome Number 判断一个整数是否是回文数
class Solution { public: bool isPalindrome(int x) { if(x return false; if(x==0) return true; int ret=0; int tmp=0; int t=x;原创 2014-01-21 19:12:18 · 454 阅读 · 0 评论 -
Reverse Integer 翻转整数
class Solution { public: int reverse(int x) { if(x==0) return 0; int flag=x>0?1:-1; int t=abs(x); int ret=0; while(t>0) { int t原创 2014-01-21 19:10:25 · 416 阅读 · 0 评论 -
Max Points on a Line 同一条直线上最大数量的点
/** * Definition for a point. * struct Point { * int x; * int y; * Point() : x(0), y(0) {} * Point(int a, int b) : x(a), y(b) {} * }; */ class Solution { public:原创 2014-01-21 20:58:11 · 386 阅读 · 0 评论 -
Spiral Matrix II 螺旋矩阵II
class Solution { public: vector > generateMatrix(int n) { vector> matrix(n,vector(n)); int begin=0; int end=n-1; int num=1; while(begin {原创 2014-01-21 20:52:56 · 332 阅读 · 0 评论 -
Multiply Strings 两个字符串的乘法
class Solution { public: string multiply(string num1, string num2) { int data[100000]={0}; reverse(num1.begin(),num1.end()); reverse(num2.begin(),num2.end());原创 2014-01-21 20:43:02 · 470 阅读 · 0 评论 -
Minimum Window Substring 包含串T的在串S中的最小窗口
class Solution { public: string minWindow(string S, string T) { int snum=S.size(); int tnum=T.size(); int minbegin=0; int minend=0; int minlength=snu原创 2014-01-21 20:40:58 · 563 阅读 · 0 评论 -
Merge Intervals 归并区间
/** * Definition for an interval. * struct Interval { * int start; * int end; * Interval() : start(0), end(0) {} * Interval(int s, int e) : start(s), end(e) {} * }; */原创 2014-01-21 19:18:42 · 371 阅读 · 0 评论 -
java面试100题
Java是一个支持并发、基于类和面向对象的计算机编程语言。下面列出了面向对象软件开发的优点:代码开发模块化,更易维护和修改。代码复用。增强代码的可靠性和灵活性。增加代码的可理解性。 面向对象编程有很多重要的特性,比如:封装,继承,多态和抽象。下面的章节我们会逐个分析这些特性。 封装 封装给对象提供了隐藏内部特性和行为的能力。对象提供一些能被其他对象访问的方法来改变它内部的数据。在Java当中,有3...原创 2018-02-20 14:56:03 · 3804 阅读 · 0 评论