一些Swift的问题列表:How to use a Objective-C #define from SwiftHow do I convert an NSDictionary to a Swift Dictionary?Swift: 'var' declaration without getter...
分类:
其他好文 时间:
2014-07-14 23:20:20
阅读次数:
205
Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For ...
分类:
其他好文 时间:
2014-07-14 19:33:04
阅读次数:
215
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
/**
* Definition for singly-linked list.
* class ListNode {
* int val;
* ...
分类:
其他好文 时间:
2014-07-13 16:32:04
阅读次数:
152
Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
You must do this in-place without altering the nodes' values.
For example,
Given {1,2,3,4}, reorder it t...
分类:
其他好文 时间:
2014-07-10 20:43:37
阅读次数:
210
题目
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
解答
首先要注意空链表不成环;不能开额外的空间,即空间复杂度是o(1),可采用“快慢指针”查检查链表是否含有环,如果在快的指针能够追上慢的指针,则有环,否...
分类:
其他好文 时间:
2014-07-08 19:17:47
阅读次数:
160
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?判断一...
分类:
其他好文 时间:
2014-07-06 18:10:33
阅读次数:
145
Divide two integers without using multiplication, division and mod operator.思路:不能使用乘法除法以及取模运算来计算两个数相除。主要做法就是,将因子不断乘2(向左移位即可实现),同时结果从1不断移位加倍,等到除数大于被除数一...
分类:
其他好文 时间:
2014-07-06 15:34:24
阅读次数:
197
Divide two integers without using multiplication, division and mod operator.不用乘、除、求余操作,返回两整数相除的结果,结果也是整数。假设除数是2,相除的商就是被除数二进制表示向右移动一位。假设被除数是a,除数是b,因为不知...
分类:
其他好文 时间:
2014-07-05 20:37:18
阅读次数:
193
Determine whether an integer is a palindrome. Do this without extra space.
Some
hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of converting the integer to string...
分类:
其他好文 时间:
2014-07-05 10:44:29
阅读次数:
227
ios 第三方qq登陆 {"ret":100030,"msg":"this api without user authorization"}...
分类:
移动开发 时间:
2014-07-03 18:05:35
阅读次数:
879