用减法可能会超时,但可以用二分
class Solution {
public:
int divide(int d1, int d2) {// d1/d2
if(d1==0)
return 0;
if(d2==1)
return d1;
if(d2==-1)
...
分类:
其他好文 时间:
2014-06-29 07:22:02
阅读次数:
208
题目
Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts needed for a palindrome partitioning of s.
For example, given s = "a...
分类:
其他好文 时间:
2014-06-20 13:44:18
阅读次数:
234
新的语言
WWDC简短的介绍,新的语言Swift就问世了,虽然新语言的名字导致贴吧下歌手粉丝和开发者们争抢地盘- -,不过雨燕就是这么来了。
WWDC keynote里给Swift打上了很多标签:
Closures,Generics,Namespaces,Type inference,Multiple return types
闭包,泛型支持,支持命名空间,去除隐式...
分类:
其他好文 时间:
2014-06-20 11:19:51
阅读次数:
207
【题目】
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ 9 20
/ 15 7
return its b...
分类:
其他好文 时间:
2014-06-20 09:42:30
阅读次数:
224
Functions and Closures 函数和封闭性(闭包)
Functions 函数的使用
Swift中的函数定义和OC中有明显的区别了,使用func定义函数,在括号中定义参数和类型,用 -> 定义返回值类型
func greet(name: String, day: String) -> String {
return "Hello \(name), tod...
分类:
其他好文 时间:
2014-06-20 09:41:20
阅读次数:
268
在JavaScript模块到底是什么event = function() { // do more
return { bind: function() {}, unbind: function() {}, trigger: function() ...
分类:
编程语言 时间:
2014-06-20 08:50:47
阅读次数:
408
class User{ String name; int age; /* *比较过程思路:
*1、两个对象指向位置相同,那么他们就相等,return后跳出函数,不再往下执行 *2、指向位置不同,有3情况 *a:这两对象类型相同,并且内容相同,也属于相等
...
分类:
编程语言 时间:
2014-06-12 00:16:40
阅读次数:
344
Merge two sorted linked lists and return it as
a new list. The new list should be made by splicing together the nodes of the
first two lists./** * Def...
分类:
其他好文 时间:
2014-06-11 22:56:31
阅读次数:
257
原题地址:https://oj.leetcode.com/problems/merge-k-sorted-lists/题意:Mergeksorted
linked lists and return it as one sorted list. Analyze and describe its com...
分类:
编程语言 时间:
2014-06-11 21:57:07
阅读次数:
399
概要:
实例代码详解:
目录结构
Car.java
package com.coslay.beans.factorybean;
public class Car {
private String brand;
private double price;
public String getBrand() {
return brand;
}
...
分类:
编程语言 时间:
2014-06-07 13:54:02
阅读次数:
252