摘要: CGImageRef并不是面向对象的API,也不是类,只是一个指针类型,Quartz 2D对CGImageRef的定义为:typedef struct CGImage *CGImageRef;由此可见,CGImageRef只是一个指针类型。下面是这两者之间的转换://CGImageRef转换成UII... 阅读全文
posted @ 2015-03-12 15:30 菜鸟加贝的爬升 阅读(1196) 评论(0) 推荐(0) 编辑
摘要: 最近看到一个阿里的面试题目,觉得很有意思,遂记下。 阿里2014年笔试题目,(选择题)是给定生成1-7的随即函数rand_7,看是否能生成其它随机数? A. rand_3 B. rand_21 C. rand_23 D.rand_47首先从最简单的开始,给定一个能够随机生成1到7之间数字的r... 阅读全文
posted @ 2015-03-04 11:51 菜鸟加贝的爬升 阅读(398) 评论(0) 推荐(0) 编辑
摘要: 【题目】: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists:... 阅读全文
posted @ 2015-02-04 12:25 菜鸟加贝的爬升 阅读(434) 评论(0) 推荐(0) 编辑
摘要: 关于有环单链表,即单链表中存在环路,该问题衍生出很多面试题,特在此汇总,方便查阅也帮助自己梳理下思路。 如下图1所示为有环单链表,假设头结点为H, 环的入口点为A。 关于有环单链表主要有几个问题:该单链表中是否真有环存在?如何求出环状的入口点?如何求出环状的长度?求解整条链表的长度? 该... 阅读全文
posted @ 2015-02-04 12:01 菜鸟加贝的爬升 阅读(448) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The functi... 阅读全文
posted @ 2015-01-15 21:01 菜鸟加贝的爬升 阅读(423) 评论(0) 推荐(0) 编辑
摘要: 【题目】:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the t... 阅读全文
posted @ 2015-01-15 20:34 菜鸟加贝的爬升 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 【题目】: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain ... 阅读全文
posted @ 2015-01-15 18:29 菜鸟加贝的爬升 阅读(642) 评论(0) 推荐(0) 编辑
摘要: 题目: Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-... 阅读全文
posted @ 2014-10-15 10:22 菜鸟加贝的爬升 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 从存储空间角度 虚函数对应一个vtable,这大家都知道,可是这个vtable其实是存储在对象的内存空间的。问题出来了,如果构造函数是虚的,就需要通过 vtable来调用,可是对象还没有实例化,也就是内存空间还没有,所以无法找到vtable。所以构造函数不能是虚函数。 从使用角度 虚函数主要用于在信息不全的情况下,能使重载的函数得到其对应的调用。构造函数本身就是要初始化实例,那使用虚... 阅读全文
posted @ 2013-10-17 17:32 菜鸟加贝的爬升 阅读(308) 评论(0) 推荐(0) 编辑
摘要: 阶乘(Factorial)是个很有意思的函数,但是不少人都比较怕它,我们来看看两个与阶乘相关的问题:1. 给定一个整数N,那么N的阶乘N!末尾有多少个0呢?例如:N=10,N!=3 628 800,N!的末尾有两个0。2. 求N!的二进制表示中最低位1的位置。分析与解法有些人碰到这样的题目会想:是不... 阅读全文
posted @ 2013-10-07 20:40 菜鸟加贝的爬升 阅读(1151) 评论(0) 推荐(0) 编辑